3 releases (breaking)

0.3.0 Jul 22, 2023
0.2.0 Mar 29, 2023
0.1.0 Mar 29, 2023

#486 in Date and time

50 downloads per month

MIT license

20KB
404 lines

Parsing ISO 8601 time interval into chrono DateTime

It is a small addition to the chrono crate, parsing ISO 8601 time interval ^wiki into IsoInterval which contains a pair of DateTime objects, that respectively mark the beginning and end of the interval.

This utility is missing in chrono possibly due to the fuzziness of duration, which can be specified against year and month, so the time passed is inherently not absolute.

Interval is absolute in that regard, because when a starting or end point is fixed, the exact number of seconds passed can be calculated.

The dates, as parsed, are in FixedOffset time zone, and can be switched out by calling IsoInterval::with_time_zone.


lib.rs:

Parsing ISO 8601 time interval into chrono DateTime

It is a small addition to the chrono crate, parsing ISO 8601 time interval ^wiki into IsoInterval which contains a pair of DateTime objects, that respectively mark the beginning and end of the interval.

This utility is missing in chrono possibly due to the fuzziness of duration, which can be specified against year and month, so the time passed is inherently not absolute. Intervals, on the other hand, are absolute in that regard, because when a starting or end point is fixed, the exact number of seconds passed can be calculated.

The dates, as parsed, are in chrono::FixedOffset time zone, and can be switched out by calling IsoInterval::with_time_zone.

Dependencies

~2–3MB
~54K SLoC