sebastienrousseau / dtt

A Rust library for parsing, validating, manipulating, and formatting dates and times 🦀
https://dttlib.com/
Apache License 2.0
6 stars 0 forks source link

iso_8601() incompatible #69

Closed Oinosseus closed 2 months ago

Oinosseus commented 3 months ago

Unfortunately dtt cannot parse it's own generated ISO 8601 strings:

fn main() {
    let dt1 = dtt::dtt_now!();
    println!("dt1 = {}", dt1.iso_8601());                       // prints: dt1 = 2024-08-06 19:23:54.377035313 +00:00:00

    let dt2 = dtt::DateTime::parse(&dt1.iso_8601()).unwrap();   // panics: InvalidFormat
    println!("dt2 = {}", dt2.iso_8601());
}

Probably this is because the iso_8601() method does not output the 'T' between date and time and there is an additional space between time and time-zone.

sebastienrousseau commented 2 months ago

@Oinosseus Thanks! This should now be fixed in the next release v0.0.7

Current PR https://github.com/sebastienrousseau/dtt/pull/70