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

Format doesn't use the timezone settings #62

Closed
no-location opened this issue Feb 20, 2014 · 2 comments
Closed

Format doesn't use the timezone settings #62

no-location opened this issue Feb 20, 2014 · 2 comments

Comments

@no-location
Copy link

I am outputting different times depending on timezones, and it works until I apply a format to them, the it output UTC0 time.

What I am testing is:

console.log(timezone);
console.log(moment().tz(timezone).zone());
console.log(moment().tz(timezone).format());
console.log(moment().tz(timezone).format('MMMM Do YYYY, h:mm:ss a'));

and the results are:

Europe/Berlin
-60
2014-02-20T11:09:56+01:00
February 20th 2014, 11:09:56 am

Asia/Chongqing
-480
2014-02-20T11:09:56+08:00
February 20th 2014, 11:09:56 am

Asia/Seoul
-540
2014-02-20T11:09:56+09:00
February 20th 2014, 11:09:56 am

Asia/Singapore
-480
2014-02-20T11:09:56+08:00
February 20th 2014, 11:09:56 am

America/Sao_Paulo
180
2014-02-20T11:09:56-03:00
February 20th 2014, 11:09:56 am

I am using the latest versions of moment, moment-timezone and the complete set of data.

@icambron
Copy link
Member

Sorry I can't be more helpful, but I wasn't able to reproduce this. E.g.:

> moment().format()
2014-02-20T23:45:01-05:00
> var timezone = "Europe/Berlin"
> moment().tz(timezone).format();
2014-02-21T05:44:14+01:00
> timezone = "Asia/Chongqing"
> moment().tz(timezone).format();
2014-02-21T12:44:29+08:00

One issue may be that the version on the momentjs.com website is not actually the latest version; can you make sure you try the one on the master branch here? (@mj1856 - we should really do something about that.)

@no-location
Copy link
Author

using the github version fixed this. thanks.

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