moment-timezone
moment-timezone copied to clipboard
isUTC() returning true erroneously
Consider:
moment.tz("2016-01-01", "Europe/London").isUTC() // true, should be false
why should it be false?
This moment is in London time. While London time is in line with UTC for part of the year, due to BST that is not always the case. While the Moment has the same offset as UTC (+00:00), it is not in fact IN UTC.
Sort of. To be technically accurate, London is never on UTC. For part of the year it's on GMT, which just happens to be aligned with UTC+0. Though they would give the same value, it's technically not UTC.
Another way to think about it is, UTC is the same everywhere, all over the planet. It does not have any locality. We may tend to think about it as being at the prime meridian, but I can use UTC in China or in America and it's still UTC.
Arguing semantics, I know. But seems relevant for this particular discussion. :smile:
Really for our purposes, the main reason is because isUTC() === true
would lead you to believe the value was in UTC mode, such as created with moment.utc(...)
or converted to utc with .utc()
, and that +00:00
was the offset for the entire year.
Didn't mean to imply that London was on UTC. Meant to imply the opposite - that it's never in UTC, it's just the same as UTC sometimes.
Noticed that Microsoft does not seem to understand this:
Yeah, I really need to get them to change that to (UTC+00:00)
in the display string. :wink:
Ok, so now that moment/moment#3098 has been merged, let's address this, and also that formatting is now using Z
instead of +00:00
.
(BTW - the MS issue above will be fixed next month. :wink:)
Central Time is showing up as _isUTC: true when created with moment.utc().