# JayVer
[![Crate][crate-badge]][crate-url]
[![Docs][docs-badge]][docs-url]
[![License][license-badge]][license-url]
[![CI][ci-badge]][ci-url]
[![MSRV][msrv-badge]][msrv-url]
[crate-badge]: <https://img.shields.io/crates/v/jayver.svg>
[crate-url]: <https://crates.io/crates/jayver>
[docs-badge]: <https://docs.rs/jayver/badge.svg>
[docs-url]: <https://docs.rs/jayver>
[license-badge]: <https://img.shields.io/crates/l/jayver.svg>
[license-url]: <#license>
[ci-badge]: <https://img.shields.io/github/actions/workflow/status/EmmettJayhart/jayver/ci.yaml?label=CI>
[ci-url]: <https://github.com/EmmettJayhart/jayver/actions?query=workflow%3Aci+branch%3Amain>
[msrv-badge]: <https://img.shields.io/crates/msrv/jayver.svg>
[msrv-url]: <#minimum-supported-rust-version>
A calendar versioning scheme for binaries developed by
[Emmett Jayhart](https://github.com/EmmettJayhart),
built upon ISO 8601 week dates and [CalVer](https://calver.org/).
JayVer follows the format: **YY**.**WW**.**PATCH**
- **YY**: ISO week-numbering year minus 2000 (e.g., `25` for 2025)
- **WW**: ISO 8601 week number (`1`-`53`)
- **PATCH**: Incremental number for patches within same week, starting at `0`
## Features
- Version requirements with comparison operators
- ISO 8601 week date validation
- Optional serialization support via serde
## Usage
```rust
use jayver::{Version, VersionReq};
// Parse a version
let version = Version::parse("25.16.3").unwrap();
assert_eq!(version.year, 25); // Year 2025 (25 + 2000)
assert_eq!(version.week, 16);
assert_eq!(version.patch, 3);
// Create a version for today
let today = Version::today();
println!("Today's version: {today}");
// Compare versions
let v1 = Version::parse("25.10.0").unwrap();
let v2 = Version::parse("25.11.0").unwrap();
assert!(v1 < v2);
// Check version requirements
let req = VersionReq::parse(">=25.10.0").unwrap();
assert!(req.matches(&v1));
// Compatible version requirements
let req = VersionReq::parse("~>25.16.0").unwrap();
let v = Version::parse("25.16.5").unwrap();
assert!(req.matches(&v)); // Same week, any patch
```
## Installation
Add JayVer to your `Cargo.toml`:
```toml
[dependencies]
jayver = "1.0"
# Optional: Enable serde support
jayver = { version = "1.0", features = ["serialization"] }
```
## Changelog
See [CHANGELOG.md](CHANGELOG.md) for more information.
### [1.0.0] - 2025-05-18
### Added
- Calendar versioning scheme with YY.WW.PATCH format
ISO week-numbering year minus 2000)
- Version requirements system with comparison operators
- `VersionReq` and `AnyVersionReq` types for version matching and constraints
- Optional serde serialization support via `serialization` feature flag
- Utility methods: `today()`, `increment_patch()`, `next_week()`
- `same_week()` method for comparing versions from the same week
- Top-level convenience functions `is_valid()` and `parse()`
- `short_year()` and `full_year()` conversion utilities for year format handling
- Comprehensive test suite including property-based tests and benchmarks
- Examples demonstrating various use cases
- `nom` parsers for `year`, `week`, `year_week`, `patch`, and `version`
- Chronological comparisons and sorting
- `FromStr` implementation for easy string parsing
- `Display` implementation for string conversion
## Minimum Supported Rust Version
This crate requires Rust 1.67.1 or later.
- **Library MSRV:** 1.67.1 (required by `time`)
- **Development MSRV:** 1.80 (required by `criterion` for running benchmarks)
The minimum supported Rust version may be bumped in minor releases.
## License
Copyright 2025 Emmett Jayhart
Licensed under either of
- Apache License, Version 2.0, ([LICENSE-APACHE.txt](LICENSE-APACHE.txt) or <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT license ([LICENSE-MIT.txt](LICENSE-MIT.txt) or <http://opensource.org/licenses/MIT>)
at your option.
## Contribution
Feel free to submit an issue and/or a pull request.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.