| Crates.io | name_time_period |
| lib.rs | name_time_period |
| version | 0.3.1 |
| created_at | 2025-06-07 00:31:42.013928+00 |
| updated_at | 2025-06-07 01:13:45.802709+00 |
| description | Name the time period a date is in, configuraiton is supported |
| homepage | https://github.com/rickprice/NameTimePeriods |
| repository | https://github.com/rickprice/NameTimePeriods |
| max_upload_size | |
| id | 1703615 |
| size | 40,536 |
A simple and extensible command-line tool written in Rust to determine which named time period (like "Mother's Day" or "Easter") a given date falls into, based on configurable YAML definitions.
The second Sunday of MayEaster, Thanksgiving, LaborDay, MLKDay, etc.days_before and days_after buffer windows.git clone https://github.com/yourusername/NameTimePeriod.git
cd NameTimePeriod
cargo build --release
rust-script:cargo install rust-script
rust-script src/main.rs
name_time_period # Checks today's date
name_time_period --date 2025-05-11
name_time_period --init # Force (re)create user config
/etc/NameTimePeriod/time_periods.yaml (global, optional)~/.config/NameTimePeriod/time_periods.yaml--inittime_periods.yamlTimePeriods:
- MothersDay:
Date: The second Sunday of May
DaysBefore: 3
DaysAfter: 1
Comment: Mother's Day
- EasterPeriod:
Date: Easter
DaysBefore: 5
DaysAfter: 2
Entries are evaluated in order, and the first match wins.
cargo test
NameTimePeriod/
├── src/
│ └── main.rs # Main logic
├── Cargo.toml
└── README.md
Q: What happens if the same key appears in both system and user configs?
A: The user config takes precedence and overrides the system config for that entry.
Q: Can I define custom holidays?
A: Yes! Just add them to the YAML using a flexible date or standard date format.
MIT License. See LICENSE for details.
Frederick Price