moment-timezone
moment-timezone copied to clipboard
defaulting to current date-time uses UTC (ignores timezone)
Moment created from formatting time sets the date as the UTC date rather than the date of the default timezone EX:
m = require('moment-timezone')
_ = m.tz.setDefault("Asia/Kolkata")
console.log(m())
console.log(m("T22:00","THH:mm"))
Output: moment.parseZone("2020-07-20T03:33:18.943+05:30") moment.parseZone("2020-07-19T22:00:00.000+05:30")
I'm pretty sure I'm seeing some behaviour related to this. It's currently 2020-07-27 in Sydney, however UTC is still the 26th. Any value I have tried from 00:00 to 23:59 gives a date on the 26th.
moment.tz("Australia/Sydney").format()
-> "2020-07-27T02:24:03+10:00"
moment.tz("00:00", "H:m", "Australia/Sydney").format()
-> "2020-07-26T00:00:00+10:00"
moment.tz("23:59", "H:m", "Australia/Sydney").format()
-> "2020-07-26T23:59:00+10:00"
If I however advance my clock to a point where Sydney and UTC are both in the same day(27th), I get stamps for the 27th as I would expect.
Yep, I can reproduce this issue on latest moment + moment-timezone. Some mechanism to request "current local time" from moment to moment-timezone might be required.
can you assign this project to me