isUTCMidnight makes for noticeably odd behavior
jashkenas opened this issue · comments
We use an isUTCMidnight()
sniff to swap out the inspected behavior of date objects ... which leads to strangeness when a user happens to land on midnight accidentally:
https://talk.observablehq.com/t/odd-date-behaviour-when-setting-hour-to-17/2125
Special-casing UTC midnight is useful for a variety of reasons (such as input type=date). We could always format dates as UTC, but that would make it harder to read local times.
Totally. Without a reified way to know the intent of the use of the date (as a date, or as a time) — I can't think of a good way for us to make this better.
For future reference, here’s the part of the spec that lead to this behavior, 20.3.3.2 Date.parse(string):
When the UTC offset representation is absent, date-only forms are interpreted as a UTC time and date-time forms are interpreted as a local time.
The “UTC offset representation” is Z.