Closed l0drex closed 11 months ago
ISO 8601 does not directly permit the use of a sign for the year, "only by prior agreement between the sender and the receiver".
As such this should be an option for fromISO
at most, defaulting to false
.
I think you're both misreading it a little. The important part is the number of extra year digits:
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.
Luxon supports plus and minus with 6 digits, so you can say +001923 or -000234, etc
Oh ok, I see. I am currently working with gedcomx dates, which are very similar to the ISO standard and got confused.
Describe the bug A clear and concise description of what the bug is. ISO8601 strings can start with a
+
or-
for dates after or before the year 0. Passing such strings toDateTime.fromISO()
results in an invalid date.To Reproduce Please share a minimal code example that triggers the problem:
Actual vs Expected behavior A clear and concise description of what you expected to happen. With a
+
, dates should be parsed exactly as without one. Starting with a-
, the date object should correspond to a time after year 0.Desktop (please complete the following information):
Additional context Add any other context about the problem here.
https://en.wikipedia.org/wiki/ISO_8601
Happens with the Javascript Date constructor as well: