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

Add day returns wrong time on the day before a day that starts at 1:00 am #409

Open
mattjohnsonpint opened this issue Oct 31, 2016 · 6 comments
Labels

Comments

@mattjohnsonpint
Copy link
Contributor

moment.tz('2016-10-15', 'America/Sao_Paulo').add(1, 'day').format()
// Expected: "2016-10-16T01:00:00-02:00"
// Actual:   "2016-10-15T23:00:00-03:00"

Without moment-timezone, and the computer's local time zone set for the equivalent zone:

moment('2016-10-15').add(1, 'day').format() // "2016-10-16T01:00:00-02:00"

This is related to (though slightly different from) moment/moment#3132.

@WGautier
Copy link

+1, stumbled upon this too.

moment('2017-10-14T03:00Z').add(1, 'day').tz('America/Sao_Paulo').toString()
"Sun Oct 15 2017 01:00:00 GMT-0200"
moment('2017-10-14T03:00Z').tz('America/Sao_Paulo').add(1, 'day').toString()
"Sat Oct 14 2017 23:00:00 GMT-0300"

@lambda-fairy
Copy link

Ran into this bug recently. This was causing an infinite loop in production:

> moment.tz('2019-03-30T00:00:00', 'America/Scoresbysund').add(1, 'day').toString()
'Sat Mar 30 2019 23:00:00 GMT-0100'

@YoginAlex
Copy link

Any update on this issue?

const date = moment.tz('01.04.1981', 'DD.MM.YYYY', 'Europe/Moscow');
const stringDate = date.format('DD.MM.YYYY');
> 31.03.1981

@YoginAlex
Copy link

Little patch for Europe/Moscow

moment.tz.add(['Europe/Moscow|LMT MMT MMT MST MDST MSD MSK +05 EET EEST MSK|-2u.h -2u.h -2v.j -3v.j -4v.j -40 -30 -50 -20 -30 -40|012324345657568656565656565698656565656565656565656565656565656565656a6|-3D8Ou.h 1sQM0 2pyW.W 1bA0 11X0 GN0 1Hb0 c4v.j ik0 3DA0 dz0 15A0 c10 2q10 iM10 2dmN0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cN0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|16e6']);

@VictorSage
Copy link

"America/Sao_Paulo" no longer observe DST, according to: https://www.timeanddate.com/time/change/brazil/sao-paulo

The lastet version still observe DST.

var saoPaulo = moment.tz("2019-11-05 12:00", "America/Sao_Paulo");
saoPaulo.format();
"2019-11-05T12:00:00-02:00"

@lbineau
Copy link

lbineau commented Oct 23, 2019

Ran into this bug recently. This was causing an infinite loop in production:

> moment.tz('2019-03-30T00:00:00', 'America/Scoresbysund').add(1, 'day').toString()
'Sat Mar 30 2019 23:00:00 GMT-0100'

I got the same infinite loop with version 0.5.27 (0.5.23 was working fine) and "Europe/Paris" timezone. It took me a while to figure it was moment-timezone minor update...

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

6 participants