moment-timezone icon indicating copy to clipboard operation
moment-timezone copied to clipboard

Constructor using UTC to fill default values instead of named time zone

Open oullah opened this issue 8 years ago • 3 comments
trafficstars

Right now I am EDT and it is 10pm. So 2am next day GMT.

The following code results in a date of tomorrow:

moment.tz({ hour: 12 }, "America/Los_Angeles").toString()
//Wed Aug 09 2017 12:00:00 GMT-0700

This was working fine earlier this afternoon. This seems like a bug. It should account for the day in the selected time zone when picking what date to use and it looks like it is probably just basing it off the day at GMT. If I am doing something wrong please let me know.

Also I am on an older version (0.5.4) so if this has been fixed please let me know.

oullah avatar Aug 09 '17 02:08 oullah

Same issue with 0.5.13

oullah avatar Aug 09 '17 02:08 oullah

Yes, it's a bug. You can work around it like so:

moment.tz("America/Los_Angeles").hour(12).toString()

mattjohnsonpint avatar Aug 29 '17 00:08 mattjohnsonpint

Having this issue as well.

fivetwentysix avatar Nov 30 '17 03:11 fivetwentysix