IJMacD/rfc3339-iso8601

Date without year

Closed this issue · 3 comments

kaleb commented

ISO8601 also supports dates without years which is a convenient way to represent birthdays or holidays: --12-25

It would be a good addition to this comparison.

ISO 8601:2000 Allowed a month and day without a year in what was known as Truncated representations. These formats omitted some of the most significant digits.
Ref: ISO 8601:2000 § 5.2.1.3 Truncated representations

Allowed examples included:

  • YY-MM-DD
  • -YY-MM
  • -YY
  • --MM-DD
  • --MM
  • ---DD
  • -Y-Www
  • -Www-D
  • -DDD

However, all the truncated representations were removed in ISO 8601:2004.

Reduced precision formats are still allowed i.e. Omitting some of the least significant digits.
Ref: ISO 8601:2004 § 4.1.2.3 Representations with reduced accuracy

The diagrams get complicated if you try to add extra circles for the various editions of the ISO standard. I'm just aiming to represent ISO 8601:2019 right now. I might consider adding an options for users to compare historical versions in the future.

kaleb commented

Just for the record, EDTF Level 2 in ISO 8601-2 adds X as an Unspecified Digit in all places, so XXXX-12-25 would be a replacement for the initial example. (Level 1 only supports replacement of the rightmost components.)