Registry / utility / chronoutil

chronoutil

JSON →
library0.2.7rscratesunverified

Provides powerful extensions to Rust's Chrono crate for date and time manipulation.

# Cargo.toml [dependencies] chronoutil = "0.2.7"
INSTALL
IMPORT
SIG · CHRONOUTIL
C
chronoutil
utilityrustv0.2.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RelativeDuration
use chronoutil::RelativeDuration;

Add a relative duration (e.g., 1 month) to a date, handling month-end overflows.

use chronoutil::RelativeDuration; use chrono::NaiveDate; fn main() { let date = NaiveDate::from_ymd_opt(2023, 1, 31).unwrap(); let shifted = date + RelativeDuration::months(1); println!("Shifted date: {}", shifted); }
Debug
Known issues
gotchaRelativeDuration::months does not simply add 30 days; it shifts the month component, which can cause unexpected date changes (e.g., Jan 31 + 1 month = Feb 28/29).
fix
Use RelativeDuration::days if you want a fixed number of days, or check the resulting date for correctness.
affects: >=0.2.0
Upgrade
Version history
0.2.7latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
chronoutil — cargo add chronoutil · libregistry