Skip to content
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

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

Closed
wants to merge 1 commit into from

Conversation

@bterlson
Copy link
Member

@bterlson bterlson commented Oct 28, 2015

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
Member

@rossberg rossberg commented Oct 29, 2015

LGTM

@mj1856
Copy link
Member

@mj1856 mj1856 commented Oct 30, 2015

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
Member

@rossberg rossberg commented Oct 30, 2015

@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
Copy link
Member Author

@bterlson bterlson commented Nov 2, 2015

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

@bterlson
Copy link
Member Author

@bterlson bterlson commented Nov 2, 2015

Committed as 4f4a37a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.