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

ISO UTC DateTime can have an hour of 0 #6

Open
erewok opened this issue Oct 30, 2016 · 3 comments
Open

ISO UTC DateTime can have an hour of 0 #6

erewok opened this issue Oct 30, 2016 · 3 comments

Comments

@erewok
Copy link

erewok commented Oct 30, 2016

Hello!

Thanks for releasing this library!

I ran into a problem when trying to use it to encode an object with UTC dates, because I have an object with a date field that looks like this:

created = <Sun Sep 18 2016 00:00:00 GMT-0700 (PDT)>

When this gets encoded back into JSON, it passes through this line, and it ends up looking like this (that's a negative one, which gets rejected by the server):

{ created: '2016-09-18T-1:00:00.000Z' }

When I found the line above, I thought, okay I'll just send in a patch and handle subtracting back to the previous day, but then I stopped when I realized I didn't know why we're subtracting one from the hour there?

@krisajenkins
Copy link
Owner

Urk - I think we're being bitten by a variant of this bug(/weird interpretation of the spec): https://twitter.com/krisajenkins/status/785479254872039424

On 30 Oct 2016, at 04:12, Erik notifications@github.com wrote:

Hello!

Thanks for releasing this library!

I ran into a problem when trying to use it to encode an object with UTC dates, because I have an object with a date field that looks like this:

created = <Sun Sep 18 2016 00:00:00 GMT-0700 (PDT)>
When this gets encoded back into JSON, it passes through this line, and it ends up looking like this (that's a negative one, which gets rejected by the server):

{ created: '2016-09-18T-1:00:00.000Z' }
When I found the line above, I thought, okay I'll just send in a patch and handle subtracting back to the previous day, but then I stopped when I realized I didn't know why we're subtracting one from the hour there?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

krisajenkins added a commit that referenced this issue Oct 31, 2016
We were formatting the date incorrectly, in a way that *mostly* works in
Chrome/Node. Then we accounted for the "mostly" part incorrectly, by
adjusting the hour for daylight saving time.
@krisajenkins
Copy link
Owner

As soon as the build verifies, I'll publish this fix as 25.13.1. Thanks for the report @pellagic-puffbomb!

@erewok
Copy link
Author

erewok commented Oct 31, 2016

Sure! Thanks for the quick turnaround!

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

No branches or pull requests

2 participants