#date-time #timezone #date #calendar #time #duration

no-std temporal_rs

Temporal in Rust is an implementation of the TC39 Temporal Builtin Proposal in Rust

5 releases

0.0.5 Mar 6, 2025
0.0.4 Dec 5, 2024
0.0.3 Jul 8, 2024
0.0.2 Mar 5, 2024
0.0.1 Feb 25, 2024

#33 in Date and time

Download history 1/week @ 2024-11-20 322/week @ 2024-12-04 43/week @ 2024-12-11 9/week @ 2025-01-08 32/week @ 2025-02-05 19/week @ 2025-02-12 5/week @ 2025-02-19 4/week @ 2025-02-26 136/week @ 2025-03-05

165 downloads per month
Used in 2 crates

MIT/Apache

660KB
14K SLoC

Temporal in Rust

Temporal is a calendar and timezone aware date/time builtin currently proposed for edition to the ECMAScript specification.

temporal_rs is an implementation of Temporal in Rust that aims to be 100% test compliant. While initially developed for Boa, the crate has been externalized as we intended to make an engine agnostic and general usage implementation of Temporal and its algorithms.

Example usage

use temporal_rs::{PlainDate, Calendar};
use tinystr::tinystr;
use core::str::FromStr;

// Create a date with an ISO calendar
let iso8601_date = PlainDate::try_new(2025, 3, 3, Calendar::default()).unwrap();

// Create a new date with the japanese calendar
let japanese_date = iso8601_date.with_calendar(Calendar::from_str("japanese").unwrap()).unwrap();
assert_eq!(japanese_date.era(), Some(tinystr!(16, "reiwa")));
assert_eq!(japanese_date.era_year(), Some(7));
assert_eq!(japanese_date.month(), 3)

Temporal proposal

Relevent links regarding Temporal can be found below.

Core maintainers

Contributing

This project is open source and welcomes anyone interested to participate. Please see CONTRIBUTING.md for more information.

Communication

Feel free to contact us on Matrix.

License

This project is licensed under the Apache or MIT licenses, at your option.

Dependencies

~4–10MB
~97K SLoC