Crates.io | temporal_rs |
lib.rs | temporal_rs |
version | |
source | src |
created_at | 2024-02-25 19:28:21.061191+00 |
updated_at | 2025-03-06 15:33:09.854538+00 |
description | Temporal in Rust is an implementation of the TC39 Temporal Builtin Proposal in Rust. |
homepage | |
repository | https://github.com/boa-dev/temporal |
max_upload_size | |
id | 1152726 |
Cargo.toml error: | TOML parse error at line 27, column 1 | 27 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
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.
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)
Relevent links regarding Temporal can be found below.
This project is open source and welcomes anyone interested to participate. Please see CONTRIBUTING.md for more information.
Feel free to contact us on Matrix.
This project is licensed under the Apache or MIT licenses, at your option.