ebarnard / rust-plist

A rusty plist parser.
MIT License
71 stars 42 forks source link

Replace `humantime` with `chrono` to support dates before 1970. #49

Closed wgoodall01 closed 4 years ago

wgoodall01 commented 4 years ago

When using rust-plist to parse an iTunes library file, I ran into parsing errors with particularly old <date> values. As it turns out, the humantime crate returns an OutOfRange error while parsing any date before 1970. This behavior is technically out of spec, as RFC3339 is defined for all years "somewhere between 0000AD and 9999AD"

This patch entirely replaces the humantime crate with chrono, and adds a test case with a date before 1970 to prevent regressions.

ebarnard commented 4 years ago

This behavior is technically out of spec, as RFC3339 is defined for all years "somewhere between 0000AD and 9999AD"

It looks like Apple deviates a bit from RFC3339. It allows negative years but not subsecond precision.

https://github.com/opensource-apple/CF/blob/master/CFPropertyList.c#L1676

ebarnard commented 4 years ago

Merged in 7b0e6d42840ca223597b82b1f44ecfe6db237659.