Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should years before 1 be shifted by 1? #108

Open
3 tasks
meduzen opened this issue Nov 25, 2023 · 1 comment
Open
3 tasks

Should years before 1 be shifted by 1? #108

meduzen opened this issue Nov 25, 2023 · 1 comment
Labels
bug Something isn't working enhancement New feature or request question Further information is requested

Comments

@meduzen
Copy link
Owner

meduzen commented Nov 25, 2023

Looking at the ISO 8601 years specifics:

ISO 8601 prescribes, as a minimum, a four-digit year [YYYY] to avoid the year 2000 problem. It therefore represents years from 0000 to 9999, year 0000 being equal to 1 BC […] However, years before 1583 (the first full year following the introduction of the Gregorian calendar) are not automatically allowed by the standard. Instead, the standard states that "values in the range [0000] through [1582] shall only be used by mutual agreement of the partners in information interchange"
To represent years before 0000 or after 9999, the standard also permits the expansion of the year representation but only by prior agreement between the sender and the receiver.[20] An expanded year representation [±YYYYY] must have an agreed-upon number of extra year digits beyond the four-digit minimum, and it must be prefixed with a + or − sign[21] instead of the more common AD/BC (or CE/BCE) notation; by convention 1 BC is labelled +0000, 2 BC is labeled −0001, and so on.[22]

Topics:

  1. Mutual agreement for the representation of years before 1583 (first year fully covered by the Gregorian calendar): using ISO 8601 for dates before 1583 is not allowed unless everyone parties agree it’s allowed.
  2. Mutual agreement needed for anything outside of the 4-digits notation, with mandatory use of the sign (event for +).
  3. What to do with “year 0”? It doesn’t exist in real world but ISO 8601 says it’s actually year -1. For new Date(-33, 0, 1).getFullYear(), does it represent actual year -33 or actual year -34? For accuracy with date diffing, it would be nice if datetime-attribute could allow to configure this behaviour (e.g. with a shiftDatesBeforeYearOne setting or with something else that would remind the era of the Temporal.PlainDateTime object). Currently new Date(-33, 0, 1) is expected to be real year -33 (see tests).

Tasks:

  • add missing + sign beyond 9999;
  • document stuff regarding “year 0”;
  • decide how to enable the year shift before year 1 (check how libraries are handling that).
@meduzen meduzen added enhancement New feature or request question Further information is requested bug Something isn't working labels Nov 25, 2023
@meduzen meduzen changed the title Should years before 1 must be shifted by 1? Should years before 1 be shifted by 1? Nov 25, 2023
@meduzen
Copy link
Owner Author

meduzen commented Nov 25, 2023

Additional resources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant