chrono-kit

Crates.iochrono-kit
lib.rschrono-kit
version0.1.1
created_at2025-08-17 02:12:25.028918+00
updated_at2025-08-17 13:02:11.948382+00
descriptionA time manipulation toolkit built on chrono
homepage
repositoryhttps://github.com/wangLiu-gh/chrono-kit
max_upload_size
id1799049
size33,610
wangLiu (wangLiu-gh)

documentation

https://docs.rs/chrono-kit

README

Chrono-kit

Crates.io Documentation License CI Test Status Coverage

A time manipulation toolkit built on chrono, providing convenient iterators and utilities for working with dates and times.

Features

Currently implemented features:

  • NaiveDateTime range iteration (NaiveDatetimeRangeIterator) with forward/reverse support
  • NaiveDateTime iteration (NaiveDatetimeIterator) with forward/reverse support
  • Basic time range calculations

Want to see something added? Open an issue with your feature request!

Usage

Add to your Cargo.toml:

[dependencies]
chrono-kit = "0.1"

Examples

use chrono_kit::iter::NaiveDatetimeRangeIterator;
use chrono::{NaiveDateTime, Duration};

let start = NaiveDateTime::parse_from_str("2023-01-01 00:00:00", "%Y-%m-%d %H:%M:%S").unwrap();
let end = NaiveDateTime::parse_from_str("2023-01-03 00:00:00", "%Y-%m-%d %H:%M:%S").unwrap();
let step = Duration::hours(1);

let mut iter = NaiveDatetimeRangeIterator::new(start, end, step).unwrap();
for (range_start, range_end) in iter {
    println!("Range: {} to {}", range_start, range_end);
}

// Reverse iteration example
let step = Duration::hours(-1); // Negative step for reverse iteration
let mut reverse_iter = NaiveDatetimeRangeIterator::new(start, end, step).unwrap();
for (range_start, range_end) in reverse_iter {
    println!("Reverse range: {} to {}", range_start, range_end);
}

License

Dual-licensed under MIT or Apache 2.0 at your option.

Commit count: 0

cargo fmt