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
Colon in timezone #24
Comments
I believe this is what @thernstig is saying. The date and time portions are using the extended format, which includes
Line 30 in 2808365
- return timezoneOffset < 0 ? "+" + h + m : "-" + h + m;
+ return (timezoneOffset < 0 ? "+" : "-") + h + ":" + m; There seems to be little to no regression as JS handles both cases. let test1 = new Date("2022-01-06T08:47:48.003+0800");
let test2 = new Date("2022-01-06T08:47:48.003+08:00");
console.log(test1.getTime() === test2.getTime());
// true Might also want to include a case of - return timezoneOffset < 0 ? "+" + h + m : "-" + h + m;
+ return timezoneOffset === 0 ? "Z" : (timezoneOffset < 0 ? "+" : "-") + h + ":" + m; |
@peteriman thank you for that comment. I re-read my original post and must have been very tired when writing it, as it ended quite abruptly without better examples of what I meant, and where the change should be made. |
For more details: #27 (comment) |
According to https://en.wikipedia.org/wiki/ISO_8601 the timezone is recommended to contain a colon.
RFC3339, that is a profile of ISO 8601, also states that the offset between local time and UTC is defined as:
As such, should the the O format string should most likely include a colon, right?
The text was updated successfully, but these errors were encountered: