chrono-kit 0.1.1

A time manipulation toolkit built on chrono
Documentation
  • Coverage
  • 77.78%
    7 out of 9 items documented2 out of 2 items with examples
  • Size
  • Source code size: 33.61 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 741.4 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 21s Average build duration of successful builds.
  • all releases: 21s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • wangLiu-gh/chrono-kit
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • wangLiu-gh

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.