-
Notifications
You must be signed in to change notification settings - Fork 61
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
📅 Fix date representation (again) #1426
Conversation
🦋 Changeset detectedLatest commit: 034a329 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -76,7 +76,7 @@ cases: | |||
affiliations: | |||
- id: univa | |||
name: University A | |||
date: 14 Dec 2021 | |||
date: '2021-12-14' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Escape YAML interpretation
Ugh, yikes, more problems:
i.e. > process.env.TZ = "America/Anchorage"
'America/Anchorage'
> new Date("2024-06-06")
2024-06-06T00:00:00.000Z
> new Date("2024-06-06 19:00")
2024-06-07T03:00:00.000Z We really need a better way to handle this. I'll update the main body of the PR dsecription. |
I think we can use |
The history of this PR will be confusing. I'll open a new one! |
Presently, our datetime handling is not quite right. We sometimes (due to
Date
) parse dates in the local timezone, but we render them in templates as UTC.i.e. for BST=UTC+1
where the
Z
suffix indicates UTC. At the moment, we then ask forgetUTCDate()
, which returns30
because the code parses the date as the00:00:00
timestamp in BST, which is23:00:00
the previous day in UTC.Instead, we should assume that a user is entering a valid "local"/"wall time" date. This PR fixes mystmd's validation to explicitly ignore timezones and directly take the day/month information from the
Date
object.Should fix #1357
See also https://tc39.es/proposal-temporal/docs/ambiguity.html