-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Date formatting to ISO string invalid (adding timezone computation) #79
Comments
@IvanDelsinne If you don't want to change the timezone of your environment, you can use new Date(Date.UTC(2018, 8, 9)).toISOString()
// "2018-09-09T00:00:00.000Z" Does that solve your issue? |
I'm gonna try to do that, I haven't managed to find this solution anywhere. Thanks for the tip. Still, allowing to provide a custom date value wouldn't be a good idea ? |
@IvanDelsinne Maybe I could allow string-based date, but existing behaviour is to avoid someone messing up the date format 🤔. How would you generate the ISO string otherwise? |
I tried that, I'm still getting the timezone conversion, with the following code snippet: let date = i.data.date.substring(0, 10).split('-').map(i => Number.parseInt(i));
date = new Date(Date.UTC(date[0], date[1], date[2])); Here, Edit: It's weird, if I print the data as debug, I get the timezone converted, but if I print theISOString, it doesn't convert. |
I'm having this same issue, but only with the |
(Perhaps) similar issue with Disregard. Figured it out. My apologies. Thanks for |
Describe the bug
When you create a date from an iso8601 string, and when you try to "render" it, e.g. with
date.toISOString()
(source:lib/atom.1.js:67
),it computes it and works with the time-zone.
I'm in a case in which I want to have absolutely 0 change from the original timestamp, but the JS conversion removes 2 hours from the actual timestamp on render.
Wouldn't it be possible for "updated" to take an iso-formatted string, either validating it or trusting the developer to not fuck up the format ?
To Reproduce
Steps to reproduce the behavior:
Tested in UTC+2 time zone
Expected behavior
I'd expect it to return Date 2018-09-09T00:00:00.000Z
More informations
The obtained error is:
Because, since I pass a correctly-formatted ISO string and not a Date instance, the validator doesn't take the value, so it evaluates to
undefined
.The text was updated successfully, but these errors were encountered: