Ashwin Hegde
Ashwin Hegde

Reputation: 1771

Incorrect timezone display with Moment.js when non-whole hour offset

I am using Moment Version 2.0.0 and for some reason i don't want to update version to 2.0.1 or above.

When i am using following code block; it shows me the correct timezone offset that is +5:30

moment().format("Z");

But when i am trying with below code its NOT showing me +0530 instead it showed me +0550

moment().format("ZZ");

So, am i missing something here. I got the solution by using below code; But i don't recommend to use regular expression. Is there any Moment solution for this.

new Date().toTimeString().match(/([-\+][0-9]+)\s/)[1]

Thanks

Upvotes: 0

Views: 296

Answers (1)

Ashwin Hegde
Ashwin Hegde

Reputation: 1771

This is resolved my Moment JS Development team; They have provided me with response to get the pull request.

Issues Raised: https://github.com/moment/moment/issues/1270

Issues Solved: https://github.com/moment/moment/pull/1278

File Changed: https://github.com/moment/moment/pull/1278/files

Thanks for your Help.

Upvotes: 1

Related Questions