Skip to content

Latest commit

History

47 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

week

Build & TestLicense: MIT

A simple and fast CLI utility to get ISO week numbers (1-53) for any date.

🚀 Quick Start

# 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.01

📖 Usage

week [OPTIONS]
OPTIONS:
-d, --date <DATE> Date to get week number for (various formats supported)
-h, --help Print help information
-V, --version Print version information

Examples

# 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 1

📅 Supported Date Formats

The tool accepts dates in multiple convenient formats:

FormatExampleDescription
DD-MM-YYYY19-02-2023Day-Month-Year with dashes
DD/MM/YYYY19/02/2023Day-Month-Year with slashes
DD.MM.YYYY19.02.2023Day-Month-Year with periods
DD-MM19-02Day-Month (uses current year)
DD/MM19/02Day-Month (uses current year)
DD.MM19.02Day-Month (uses current year)

Note: All formats use DD-MM ordering (day first, then month)

🛠️ Installation

From Source

# Clone the repository
git clone https://github.com/billyto/week.git
cd week
# Build and install
cargo install --path week

From Releases

Download pre-built binaries from the releases page for:

  • Windows (x86_64)
  • Linux (x86_64)
  • macOS (x86_64)

🧪 Development

Prerequisites

  • Rust 1.70.0 or later
  • Cargo

Building

cd week
cargo build --release

Running Tests

# Unit tests
cargo test# Integration tests
cargo test --test cli

Project Structure

week/
├── src/
│ ├── lib.rs # Core date parsing logic
│ └── main.rs # CLI interface
├── tests/
│ └── cli_tests.rs # Integration tests
└── Cargo.toml # Dependencies and metadata

📋 About ISO Week Numbers

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

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🗺️ Roadmap

  • 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 🐮

🐛 Known Issues

  • 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)

About

Simple CLI to get the week of the year for a give date

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages