Go to file
Kang Seonghoon 86665d0a7f 0.1.2: no more `num` dependency, multidispatched addition.
- `num` dependency is gone. It was only used for floored division
  and it is not hard to copy only that portion from num.
- `Duration + Date` (or so) was blocked by rust-lang/rust#7590,
  which has been subsequently fixed.
- Removed unused `unsafe` checks.
2014-11-24 14:52:07 +09:00
src 0.1.2: no more `num` dependency, multidispatched addition. 2014-11-24 14:52:07 +09:00
.gitignore fixed .travis.yml to use the correct URL for Cargo nightly. 2014-08-21 09:31:15 +09:00
.travis.yml simplified .travis.yml. 2014-08-27 01:30:00 +09:00
Cargo.toml 0.1.2: no more `num` dependency, multidispatched addition. 2014-11-24 14:52:07 +09:00
LICENSE.txt relicensed from MIT to dual MIT/APL2. closes #2. 2014-07-25 21:25:10 +09:00
README.md 0.1.1: language changes, updated documentations. 2014-11-21 16:18:55 +09:00

README.md

Rust-chrono

Rust-chrono on Travis CI

Date and time handling for Rust.

Complete Documentation

// find out if the doomsday rule is correct!
use chrono::{Weekday, NaiveDate, naive};
use std::iter::range_inclusive;

for y in range_inclusive(naive::date::MIN.year(), naive::date::MAX.year()) {
    // even months
    let d4   = NaiveDate::from_ymd(y,  4,  4);
    let d6   = NaiveDate::from_ymd(y,  6,  6);
    let d8   = NaiveDate::from_ymd(y,  8,  8);
    let d10  = NaiveDate::from_ymd(y, 10, 10);
    let d12  = NaiveDate::from_ymd(y, 12, 12);

    // nine to five, seven-eleven
    let d59  = NaiveDate::from_ymd(y,  5,  9);
    let d95  = NaiveDate::from_ymd(y,  9,  5);
    let d711 = NaiveDate::from_ymd(y,  7, 11);
    let d117 = NaiveDate::from_ymd(y, 11,  7);

    // "March 0"
    let d30  = NaiveDate::from_ymd(y,  3,  1).pred();

    let weekday = d30.weekday();
    let other_dates = [d4, d6, d8, d10, d12, d59, d95, d711, d117];
    assert!(other_dates.iter().all(|d| d.weekday() == weekday));
}

Design Goals

  • 1-to-1 correspondence with ISO 8601.
  • Timezone-aware by default.
  • Space efficient.
  • Moderate lookup table size, should not exceed a few KBs.
  • Avoid divisions as much as possible.

References