A simple and fast CLI utility to get ISO week numbers (1-53) for any date.
# Get current week number
week
# Get week number for a specific date
week --date 19-02-2023
week -d 15/03/2024
week -d 01.01week [OPTIONS]
OPTIONS:
-d, --date <DATE> Date to get week number for (various formats supported)
-h, --help Print help information
-V, --version Print version information
# Current week
$ week
Week 24
# Specific date with year
$ week --date 19-02-2023
Week 7
$ week -d 25/12/2023
Week 52
# Date without year (uses current year)
$ week -d 15/03
Week 11
$ week -d 01.01
Week 1The tool accepts dates in multiple convenient formats:
| Format | Example | Description |
|---|---|---|
DD-MM-YYYY |
19-02-2023 |
Day-Month-Year with dashes |
DD/MM/YYYY |
19/02/2023 |
Day-Month-Year with slashes |
DD.MM.YYYY |
19.02.2023 |
Day-Month-Year with periods |
DD-MM |
19-02 |
Day-Month (uses current year) |
DD/MM |
19/02 |
Day-Month (uses current year) |
DD.MM |
19.02 |
Day-Month (uses current year) |
Note: All formats use DD-MM ordering (day first, then month)
# Clone the repository
git clone https://github.com/billyto/week.git
cd week
# Build and install
cargo install --path weekDownload pre-built binaries from the releases page for:
- Windows (x86_64)
- Linux (x86_64)
- macOS (x86_64)
- Rust 1.70.0 or later
- Cargo
cd week
cargo build --release# Unit tests
cargo test
# Integration tests
cargo test --test cliweek/
├── src/
│ ├── lib.rs # Core date parsing logic
│ └── main.rs # CLI interface
├── tests/
│ └── cli_tests.rs # Integration tests
└── Cargo.toml # Dependencies and metadata
This tool returns ISO week numbers according to ISO 8601:
- Week numbers range from 1 to 53
- Week 1 is the first week with at least 4 days in the new year
- Weeks start on Monday
- Some years have 53 weeks
This project is licensed under the MIT License - see the LICENSE file for details.
- Support multiple date formats
- CI/CD pipeline for releases
- Comprehensive CLI help
- Integration tests
- Add more date format support (ISO 8601, US format)
- Verbose and Quiet flags
- Cowsay option 🐮
- Error handling for invalid dates could be more descriptive
- Limited to Gregorian calendar only
- It will parse two-digit years as 00YY, isntead of output an error message (chrono library issue)