taian 0.1.0

A Rust library and CLI tool for calculating Rokuyo (Japanese calendar fortune)
Documentation
# taian

[![Crates.io](https://img.shields.io/crates/v/taian.svg)](https://crates.io/crates/taian)
[![Documentation](https://docs.rs/taian/badge.svg)](https://docs.rs/taian)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A Rust library and CLI tool for calculating Rokuyo (六曜), a traditional Japanese calendar system.

Rokuyo is a calendar annotation system that originated in China and is widely used in Japan. It consists of six days: Sensho, Tomobiki, Senbu, Butsumetsu, Taian, and Shakku, calculated from the lunar calendar's month and day.

## Features

- Accurate lunar calendar calculation (using `chinese-lunisolar-calendar`)
- Provides both library and CLI
- Simple and easy-to-use API

## Installation

### As a Library

```toml
[dependencies]
taian = "0.1"
```

### As a CLI Tool

```bash
cargo install taian
```

## Usage

### As a Library

```rust
use taian::{calculate_rokuyo, Rokuyo};
use chrono::NaiveDate;

fn main() {
    let date = NaiveDate::from_ymd_opt(2026, 2, 17).unwrap();

    if let Some(rokuyo) = calculate_rokuyo(date) {
        println!("Rokuyo: {}", rokuyo); // Rokuyo: Sensho

        match rokuyo {
            Rokuyo::Taian => println!("Taian - Auspicious all day"),
            Rokuyo::Shakku => println!("Shakku - Auspicious only at noon, inauspicious at other times"),
            Rokuyo::Sensho => println!("Sensho - Auspicious in the morning, inauspicious in the afternoon"),
            Rokuyo::Tomobiki => println!("Tomobiki - Auspicious in the morning and evening, inauspicious at noon"),
            Rokuyo::Senbu => println!("Senbu - Inauspicious in the morning, auspicious in the afternoon"),
            Rokuyo::Butsumetsu => println!("Butsumetsu - Inauspicious all day"),
        }
    }
}
```

### As a CLI Tool

```bash
# Display today's Rokuyo
$ taian
Rokuyo for March 17, 2026: Taian

# Display Rokuyo for a specific date
$ taian 2026 2 17
Rokuyo for February 17, 2026: Sensho
```

## About Rokuyo

| Rokuyo | Reading | Meaning |
|------|------|------|
| 先勝 (Sensho) | senshou/senkachi | Auspicious in the morning, inauspicious in the afternoon |
| 友引 (Tomobiki) | tomobiki | Auspicious in the morning and evening, inauspicious at noon. Day to avoid funerals |
| 先負 (Senbu) | senbu/sakimake | Inauspicious in the morning, auspicious in the afternoon |
| 仏滅 (Butsumetsu) | butsumetsu | Inauspicious all day |
| 大安 (Taian) | taian | Auspicious all day |
| 赤口 (Shakku) | shakkou/shakku | Auspicious only at noon, inauspicious at other times |

## Calculation Method

Rokuyo is calculated from the lunar calendar's month and day:

1. The Rokuyo for the 1st day of each lunar month is fixed:
   - Months 1 & 7: Sensho
   - Months 2 & 8: Tomobiki
   - Months 3 & 9: Senbu
   - Months 4 & 10: Butsumetsu
   - Months 5 & 11: Taian
   - Months 6 & 12: Shakku

2. After that, it cycles through the sequence: Sensho → Tomobiki → Senbu → Butsumetsu → Taian → Shakku

## License

MIT License - See [LICENSE](LICENSE) for details.

## References

- [Rokuyo Calculation Method - Musashiya]https://www.musashiya.co.jp/column/koyomi-fuzoku/rokuyou-douyatte/ (Japanese)