chronotope / chrono

Date and time library for Rust
Other
3.3k stars 525 forks source link

Clarify which revision of ISO 8601 Chrono adheres to #543

Open xTibor opened 3 years ago

xTibor commented 3 years ago

The README states Chrono strictly adheres to ISO 8601. I think this statement is slightly ambiguous, there are multiple revisions of the standard with minor differences. Would be nice to know which one Chrono actually follows. (2004?, 2019?)

pitdicker commented 1 year ago

I don't think chrono adheres all that strictly, more that it drew a lot of inspiration from ISO 8601. About the revisions ISO 8601:2019 contains this note (https://www.iso.org/obp/ui/en/#iso:std:iso:8601:-1:ed-1:v1:en):

The main changes compared to ISO 8601:2004 are as follows:

  • conversion of the content as Part 1 with the Part title “Basic rules” due to the addition of another Part 2 “Extensions” of ISO 8601;
  • replacement of the term “midnight” with “beginning of day”, disallowing the value “24” for hour;
  • update of terms and definitions:
  • “time point” is now “time”;
  • “local time” is now “local time of day”;
  • added definition for “time of day” and “local time scale”;
  • updated definitions for “standard time of day”, “local time of day” and “UTC of day” to rely on “time of day”;
  • combined two “day” terms in different domains for consistency;
  • change of the representation of “leap seconds”;
  • clarification of “calendar day” expressions intended to mean “calendar day of week” (etc.);
  • amendment of the recurring time interval (3.1.1.11) to provide a link to ISO 8601-2:2019 which contains in Clause 5 the “repeat rules for recurring time intervals”.

So mostly changes to terminology.

"disallowing the value “24” for hour;" is interesting. Chrono never supported that. Yet for an ISO 8601 parser in https://github.com/chronotope/chrono/pull/1143 I think it makes sense to support both the newer and older standard. I.e. to support the value 24 for hours to main midnight at the end of the day.

xTibor commented 1 year ago

I don't think chrono adheres all that strictly, more that it drew a lot of inspiration from ISO 8601

Just for reference, strict ISO 8601 adherence was the first feature chrono stated in its README file when I filed this issue. It has been removed from the README since then.

https://github.com/chronotope/chrono/blob/8bd13db2425301a9b60a309a79b61c72f1cf79f0/README.md?plain=1#L22

pitdicker commented 1 year ago

I understand. That claim has been there since pretty much the first release of chrono. At the time it was written the revision was 2014.

But you opened a good issue. If we promise to strictly follow a standard, it should also correctly reference the standard including revision.

For my work every rapport and all the software starts with a list of the relevant building codes, which have to be specified including revision, amendments, corrections and national annexes.

I just don't know yet how much chrono should advertise the ISO 8601 support in the main documentation. Maybe it should not be more than a section that documents the relevant parsing and formatting methods, as ISO 8601 is mostly for interchange and does not specify how to do calculations on date and time values.

pitdicker commented 1 year ago

@xTibor Do you have experience with this? Does it sometimes come up in a list of requirements like "the software must support ISO 8601:2019", and libraries must be picked to match? I hope you understand what I mean to say...