whatwg-datetime

License CI Security audit codecov

A Rust crate for parsing the datetime microsyntax, as defined by the WHATWG HTML Standard.

Install

shell cargo add whatwg-datetime

Usage

This library currently implements 8 of the 9 datetime formats defined by the WHATWG HTML Standard. The only format not implemented is the duration format, which is tracked in issue #29.

```rust use chrono::{DateTime, NaiveDate, NaiveDateTime, NaiveTime, Utc}; use whatwgdatetime::parseglobal_datetime;

asserteq!( parseglobaldatetime("2011-11-18T14:54Z"), Some(DateTime::::fromutc( NaiveDateTime::new( NaiveDate::fromymdopt(2011, 11, 18).unwrap(), NaiveTime::fromhmsopt(14, 54, 0).unwrap(), ), Utc, )) ); ```

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.