Skip to content

Normative: Date.parse treats date-only no offset as UTC#138

Closed
bterlson wants to merge 1 commit into
tc39:masterfrom
bterlson:local-date
Closed

Normative: Date.parse treats date-only no offset as UTC#138
bterlson wants to merge 1 commit into
tc39:masterfrom
bterlson:local-date

Conversation

@bterlson

Copy link
Copy Markdown
Member

This is a potential fix for #87. Previously, date-time forms without offsets were specified as local time and date-only forms were unspecified. This clarifies the web-reality semantics of interpreting date-only forms without offsets as UTC time.

Previously, date-time forms without offsets were specified as local time and date-only forms were unspecified. This clarifies the web-reality semantics of interpreting date-only forms without offsets as UTC time.
@rossberg

Copy link
Copy Markdown
Member

LGTM

@mattjohnsonpint

Copy link
Copy Markdown

While this fixes the spec to match what browsers have implemented, I'd like to state for the record that I think it is wrong.

IMHO, the behavior should be consistent for both forms. Writing new Date("2015-01-01") should be identical to writing new Date("2015-01-01T00:00:00"), and that form can't be interpreted as UTC because otherwise there'd be no way to specify local time if you wanted to.

Of course, if midnight local time doesn't exist due to DST transition, such as 2016-10-16 in America/Sao_Paulo (Brazil), then 2016-10-16T00:00:00 should adjust forward to the start of the day, which would be 2016-10-16T01:00:00 in this case, which would apply to both date-only and date-time forms.

Hopefully this can be re-addressed in some future version.

@rossberg

Copy link
Copy Markdown
Member

@mj1856, in an ideal world, I'd agree with you. But like so many problems with JavaScript, it turned out that this can't be fixed without breaking the web. So I doubt there's ever going to be a chance to rectify it.

@bterlson

bterlson commented Nov 2, 2015

Copy link
Copy Markdown
Member Author

FWIW, I also agree :) But I'm going to pull this in now!

@bterlson

bterlson commented Nov 2, 2015

Copy link
Copy Markdown
Member Author

Committed as 4f4a37a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants