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

parseZone() not parsing UTC correctly #3463

Closed
tian-ma opened this Issue Sep 23, 2016 · 6 comments

Comments

Projects
None yet
6 participants
@tian-ma

tian-ma commented Sep 23, 2016

On latest version (2.15.1), parseZone() seems not working correctly when offset is utc.

moment.parseZone('2016-05-04T00:00:00Z').format()
=> "2016-05-04T08:00:00Z" bad

moment.parseZone('2016-05-04T00:00:00+08:00').format()
=> "2016-05-04T00:00:00+08:00" good

The method was good on 2.14.1, I recently updated moment.js to 2.15.1 and the new version failed my test case.

@maggiepint

This comment has been minimized.

Member

maggiepint commented Sep 23, 2016

Yep. That's wrong. I'll maybe see if I can't tackle that one tonight, I think I know where it happened.

@tlrobinson

This comment has been minimized.

tlrobinson commented Oct 5, 2016

FYI this bug was introduced in the fix for #3083, b2ee2d4

@mfn

This comment has been minimized.

mfn commented Oct 14, 2016

Is this maybe related? I tested with with 2.15.1 too:

t = moment().toISOString();
console.log(t.toString());
parsed = moment.parseZone(t);
console.log(parsed.toISOString());

Outputs:

2016-10-14T15:33:37.457Z
2016-10-14T17:33:37.457Z

My local time is "Europe/Vienna" and thus I know where the 2 hour difference probably comes from but I don't see why it should do it.

With 2.14.1 I get the expected output:

2016-10-14T15:36:23.956Z
2016-10-14T15:36:23.956Z
@wi-ski

This comment has been minimized.

Contributor

wi-ski commented Oct 14, 2016

PR handles the issue I believe - #3504 - Please let me know if its just flat wrong. @maggiepint

@mfn

This comment has been minimized.

mfn commented Oct 14, 2016

I can confirm that it fixes my problem from #3463 (comment)

@wi-ski

This comment has been minimized.

Contributor

wi-ski commented Oct 15, 2016

#3504 just got labeled a bug fix w00t!

ichernev added a commit to ichernev/moment that referenced this issue Nov 8, 2016

ichernev added a commit that referenced this issue Nov 8, 2016

@mj1856 mj1856 removed the Up-For-Grabs label Nov 10, 2016

ichernev added a commit that referenced this issue Nov 12, 2016

Merge pull request #3504 from willdembinski:development
[tests] Fixes #3463, parseZone not handling Z correctly (tests only)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment