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() -> _isUTC is false for offset returning -0 #3521

Closed
mdemblani opened this issue Oct 22, 2016 · 2 comments
Closed

moment() -> _isUTC is false for offset returning -0 #3521

mdemblani opened this issue Oct 22, 2016 · 2 comments
Labels

Comments

@mdemblani
Copy link

Description of the Issue and Steps to Reproduce:
On bootstraping the node application, when the timezone is set to UTC using the env variable as follows:
process.env.TZ = 'UTC';

The timezone is updated. MomentJS returns the date object in UTC Time. But inspecting the moment-date object closely shows that the flag _isUTC is set to false. On further inspection with the JS date object,

var d = new Date();
d.getTimezoneOffset();        //Returns 0

moment().utcOffset();          //Returns -0

Further checking it, if timezone is updated to 0 for moment object, everything works fine, but when it is -0, it does not.

Environment:

  1. MomentJS - 2.14.1
  2. Node - 6.2.2
  3. Ubuntu - 16.04

Code to run before reporting

console.log( (new Date()).toString())
console.log((new Date()).toLocaleString())
console.log( (new Date()).getTimezoneOffset())
console.log( navigator.userAgent)
console.log(moment.version)

Output:

  1. 'Sat Oct 22 2016 15:18:09 GMT+0000 (UTC)'
  2. '10/22/2016, 3:18:25 PM'
  3. 0
  4. NA - Node.JS
    5.2.14.1
@icambron
Copy link
Member

Confirmed in 2.15.1.

@icambron
Copy link
Member

icambron commented Nov 6, 2016

Fixed in #3523.

@icambron icambron closed this as completed Nov 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants