rstime 0.1.0

A zero-dependency Rust time library providing date, time, datetime types with formatting, parsing, Unix timestamps, and clock functionality.
Documentation
use rstime::{DateTime, Date, Time, TimeFormat};

fn main() {
    println!("=== rstime 格式化测试 ===\n");

    let dt = DateTime::from_ymd_hms_milli(2026, 5, 10, 14, 5, 9, 37);
    let d = Date::new(2026, 5, 10);
    let t = Time::new(14, 5, 9, 37);

    println!("DateTime 格式化:");
    println!("  YYYY-MM-DD HH:mm:ss    → {}", dt.format("{YYYY}-{MM}-{DD} {HH}:{mm}:{ss}"));
    println!("  YYYY/MM/DD             → {}", dt.format("{YYYY}/{MM}/{DD}"));
    println!("  YY-M-D                  → {}", dt.format("{YY}-{M}-{D}"));
    println!("  12h                     → {}", dt.format("{hh}:{mm} {AMPM}"));
    println!("  12h lowercase           → {}", dt.format("{h}:{m} {ampm}"));
    println!("  With millis             → {}", dt.format("{HH}:{mm}:{ss}.{SSS}"));
    println!("  Weekday short           → {}", dt.format("{W}"));
    println!("  Weekday full            → {}", dt.format("{WW}"));
    println!("  Literal text            → {}", dt.format("Today is {YYYY}-{MM}-{DD}!"));
    println!();

    println!("Date 格式化:");
    println!("  YYYY-MM-DD              → {}", d.format("{YYYY}-{MM}-{DD}"));
    println!("  Chinese date            → {}", d.format("{YYYY}年{MM}月{DD}日"));
    println!("  Year only               → {}", d.format("{YYYY}"));
    println!();

    println!("Time 格式化:");
    println!("  HH:mm:ss                → {}", t.format("{HH}:{mm}:{ss}"));
    println!("  12h with AM/PM          → {}", t.format("{hh}:{mm} {AMPM}"));
    println!("  With millis             → {}", t.format("{HH}:{mm}:{ss}.{SSS}"));
    println!();

    println!("预置格式:");
    println!("  ISO8601:      {}", dt.format("{YYYY}-{MM}-{DD}T{HH}:{mm}:{ss}"));
    println!("  RFC2822-ish:  {}", dt.format("{W}, {DD} {MM} {YYYY} {HH}:{mm}:{ss}"));
    println!();

    println!("边界值测试:");
    let midnight = Time::MIDNIGHT;
    let noon = Time::NOON;
    let max = Time::MAX;
    println!("  Midnight  → {}", midnight.format("{HH}:{mm}:{ss} {AMPM}"));
    println!("  Noon      → {}", noon.format("{HH}:{mm}:{ss} {AMPM}"));
    println!("  Max       → {}", max.format("{HH}:{mm}:{ss}.{SSS}"));
    println!();

    println!("✅ 格式化测试完成!");
}