Repository navigation
Carry the date of a date element as text - #15
Merged
Merged
Conversation
A date without a time of day cannot be carried unambiguously in a Javascript
Date. Reading one back means choosing between the local getters and the UTC
ones, and either choice shifts the day for somebody: parseBarcode("]C117250630")
serialised with toISOString() from Auckland gives the 29th of June.
Date elements now also carry isoDate, read off the getters the date was built
with, so it says the day the barcode says wherever the reader sits. Elements
holding a time put that there too, as "1985-06-30T14:35".
The date is the resolved one rather than the digits as scanned, so a day of
"00" reads as the last day of that month, matching data. Every other kind of
element has isoDate empty.
Nothing existing changes, which is the point: the alternative was moving data
itself to UTC, and that trades one set of callers for another.
This was referenced Aug 13, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the problem behind #2 without the trade-off that PR carries.
A date with no time of day cannot be carried unambiguously in a
Date. Reading one back means choosing local getters or UTC ones, and either choice shifts the day for someone:So date elements now also carry
isoDate:It is the resolved date, so a day of
00reads as the last day of that month. Empty on elements that hold no date.Nothing existing changes. #2 instead moves
dataitself to UTC, which fixes the ISO case and breaks the local-getter one — merged onto currentmasterit fails 1 spec in CEST and 3 in New York, and leavesparseDateandparseLongDatedisagreeing about midnight.371 specs, 0 failures, run in UTC, Dublin and New York. Coverage still 100%.