use-timezone 0.1.0

Small time zone and fixed offset primitives for RustUse
Documentation
  • Coverage
  • 100%
    35 out of 35 items documented1 out of 23 items with examples
  • Size
  • Source code size: 18.34 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 588.74 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 6s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-locale
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-timezone

Small time zone and fixed offset primitives for RustUse.

Example

use use_timezone::{TimeZone, TimeZoneOffset, parse_time_zone};

let zone = parse_time_zone("America/New_York").unwrap();
let offset = TimeZoneOffset::new("UTC+05:30").unwrap();

assert!(matches!(zone, TimeZone::Iana(_)));
assert_eq!(offset.total_minutes(), 330);
assert_eq!(parse_time_zone("-0800").unwrap().to_string(), "UTC-08:00");

Scope

  • Represent an IANA-shaped time zone identifier or a fixed UTC/GMT offset.
  • Reuse use-time-zone-id for IANA-shaped identifier syntax.
  • Parse fixed offsets such as Z, UTC, +05:30, -0800, and GMT-08:00.
  • Keep fixed offsets within the civil -14:00..=+14:00 range.

Non-goals

  • Time arithmetic.
  • Daylight-saving calculations.
  • Date/time conversion.
  • Local system time zone discovery.
  • Bundled tzdb data.
  • Replacement for time, chrono, or tz-rs.

License

Licensed under either of the following, at your option:

  • Apache License, Version 2.0
  • MIT license