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

moment.tz not compatible with ISO8601 tz strings? #72

Closed
maxkostow opened this issue Apr 8, 2014 · 4 comments
Closed

moment.tz not compatible with ISO8601 tz strings? #72

maxkostow opened this issue Apr 8, 2014 · 4 comments
Milestone

Comments

@maxkostow
Copy link

In an attempt to get adding and subtracting around DST boundaries to work, I attempted to upgrade to the latest develop branch but ran into another issue. (#66 (comment))

moment: https://github.com/moment/moment/blob/0b2dfcbe949f6ed4a7a17168dadcc560ffc54066/moment.js
moment-timezone: https://github.com/moment/moment-timezone/blob/20dee3d34203da99b4189670d8d34e457877ea81/moment-timezone.js

var isoString = '2013-01-01T12:05:33.123Z';

isoString === moment.tz(isoString, 'America/Los_Angeles').toISOString();
// -> false // expected `true` like on 2.5.1/0.0.3

moment.tz(isoString, 'America/Los_Angeles').toISOString();
// -> "2013-01-01T15:05:33.123Z" // where did the extra 3 hours come from?
@maxkostow maxkostow changed the title moment.tz not compatible with ISO8601 strings? moment.tz not compatible with ISO8601 tz strings? Apr 8, 2014
@timrwood
Copy link
Member

Yeah, the moment.tz(..., zone) constructor is kind of naive right now.

I have some failing tests at #27 that I have tried (and failed) to get passing a couple times with no luck. I think that the changes in #82 would make #27 easier.

In the mean time, you can use the following syntax instead, which should be more accurate.

moment('2013-01-01T12:05:33.123Z').tz('America/Los_Angeles');

@timrwood
Copy link
Member

This is fixed with #93.

@timrwood timrwood added this to the 0.1.0 milestone Jun 18, 2014
@timrwood
Copy link
Member

This is released in 0.1.0.

@maxkostow
Copy link
Author

:shipit: Thanks @timrwood

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