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

Timezone America/Sao_Paulo is wrong DST (now is -2 and correct is -3) #797

Closed
alissonjdb opened this issue Nov 4, 2019 · 21 comments
Closed

Comments

@alissonjdb
Copy link

alissonjdb commented Nov 4, 2019

In this link is possible see the wrong when click in America/Sao_paulo
https://momentjs.com/timezone/

Brazil stop using DST but , moment timezone is using DST.

Can I set the configuration for stop using DST?

@silvacpp
Copy link

silvacpp commented Nov 4, 2019

+1

@lucasvrocha
Copy link

lucasvrocha commented Nov 4, 2019

Hi, I am got this erro using just moment (without 'moment-timezone') so I install 'moment-timezone' and set ' moment.tz('America/Sao_Paulo')' to fix them.

https://momentjs.com/timezone/docs/#/use-it/node-js/

PS.: Is possible to set with default timezone 'moment.tz.setDefault('America/Sao_Paulo');'

@icaroce
Copy link

icaroce commented Nov 4, 2019

Brazil no longer has DST changes - decree signed today
https://g1.globo.com/politica/noticia/2019/04/25/bolsonaro-assina-decreto-que-acaba-com-o-horario-de-verao.ghtml
From Daniel Soares de Oliveira (2019-04-26):
http://www.planalto.gov.br/ccivil_03/_Ato2019-2022/2019/Decreto/D9772.htm

@lucasvrocha
Copy link

In this link is possible see the wrong when click in America/Sao_paulo
https://momentjs.com/timezone/

Brazil stop using DST but , moment timizone is using DST.

Can I set the configuration for stop using DST?

You can use 'moment.tz.setDefault('America/Sao_Paulo');'

@alessandroapg
Copy link

+1

@alissonjdb
Copy link
Author

You can use 'moment.tz.setDefault('America/Sao_Paulo');'

mine already has this config ;(

@lucasvrocha
Copy link

You can use 'moment.tz.setDefault('America/Sao_Paulo');'

mine already has this config ;(

Maybe, have to use the last version.
Check the moment-timezone version, if not is last , update it.

https://github.com/moment/moment-timezone
https://www.npmjs.com/package/moment-timezone

@felipewaku
Copy link

felipewaku commented Nov 4, 2019

A possible workaround is to use Bahia's timezone: moment.tz.setDefault('America/Bahia');. This timezone doesn't use DST and it is at -3 .

@ValchanOficial
Copy link

const moment = require('moment-timezone').tz.setDefault('America/Sao_Paulo');
//returns the right time

const moment = require('moment');
//returns with + 1h

@DaniloSI
Copy link

DaniloSI commented Nov 4, 2019

I got the same problem. But, with Cuiabá's timezone which is using DST. 😕

@douglasjunior
Copy link

douglasjunior commented Nov 5, 2019

Same problem here.

If I use new Date().getTimezoneOffset() it returns 180 in some browsers and 120 in others.

But the moment().utcOffset() aways returns -120.

@alissonjdb
Copy link
Author

A possible workaround is to use Bahia's timezone: moment.tz.setDefault('America/Bahia');. This timezone doesn't use DST and it is at -3 .

Good workaround, but in my case, the custumer can set his timezone, now I set -1 hardcode to work in america/sao_paulo.

I'm waiting for the fix in momment plugin =D

@MassimilianoCarosi
Copy link

MassimilianoCarosi commented Nov 5, 2019

I patched it by myself. Search for the string "America/Sao_Paulo|LMT" in the source file of moment-timezone and replace the whole row with the following:

"America/Sao_Paulo|LMT -03 -02|36.s 30 20|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2glwR.w HdKR.w 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 pTd0 PX0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 1EN0 Lz0 1C10 IL0 1HB0 Db0 1HB0 On0 1zd0 On0 1zd0 Lz0 1zd0 Rb0 1wN0 Wn0 1tB0 Rb0 1tB0 WL0 1tB0 Rb0 1zd0 On0 1HB0 FX0 1C10 Lz0 1Ip0 HX0 1zd0 On0 1HB0 IL0 1wp0 On0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 Rb0 1zd0 Lz0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 On0 1zd0 On0 1HB0 FX0|20e6",

I hope this will help.

@douglasjunior
Copy link

After upgrade to moment-timezone:0.5.27 worked for us in most browsers, and I recommend upgrade the browsers too.

@dustinsgoodman
Copy link

Can confirm that this is working in moment-timezone versions 0.5.26 and later. However, the abbreviation for the timezone is now non-functioning. See https://codesandbox.io/s/objective-pasteur-znco2 for a demo of the timezone working but the abbreviation not working.

@leonardocouy
Copy link

Guys, upgrade your chrome/firefox/safari to latest version and it will works nicely 👍.

@DaniloSI
Copy link

DaniloSI commented Nov 6, 2019

Guys, upgrade your chrome/firefox/safari to latest version and it will works nicely 👍.

I can't ask customers of my product to do this 😢

@MassimilianoCarosi
Copy link

Please don't answer if you did not get the point.

In the current official distribution of timezone-moment-with-data.js (0.5.25-2019a, this is the link https://momentjs.com/timezone/), the timezone America/Sao_Paulo has a programmatic change to DST on November, 3th 2019 and so on for all the following years. This is not a bug that you can fix by upgrading the browser. This is a wrong information in the data caused by a missing change after this decree: https://g1.globo.com/politica/noticia/2019/04/25/bolsonaro-assina-decreto-que-acaba-com-o-horario-de-verao.ghtml.

The problem can be solved by installing a newer version of moment-timezone-with-data.js (if the developer team includes this upgrade) or by patching it by yourself following these easy steps, as already posted above:

Search for the string "America/Sao_Paulo|LMT" in the source file of moment-timezone and replace the whole row with the following:

"America/Sao_Paulo|LMT -03 -02|36.s 30 20|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2glwR.w HdKR.w 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 pTd0 PX0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 1EN0 Lz0 1C10 IL0 1HB0 Db0 1HB0 On0 1zd0 On0 1zd0 Lz0 1zd0 Rb0 1wN0 Wn0 1tB0 Rb0 1tB0 WL0 1tB0 Rb0 1zd0 On0 1HB0 FX0 1C10 Lz0 1Ip0 HX0 1zd0 On0 1HB0 IL0 1wp0 On0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 Rb0 1zd0 Lz0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 On0 1zd0 On0 1HB0 FX0|20e6".

As you can see what I am doing is using the same data as before but with dates only until last DST change. That's all.

@douglasjunior
Copy link

@MassimilianoCarosi the current moment-timezone version is 0.5.27 and uses TZDB 2019c.

Look at releases page: https://github.com/moment/moment-timezone/releases

image

About browsers, @leonardocouy is right too, because the browsers also had the wrong timezone in old versions.
Three days ago, if I ran new Date().getCurrentTimezone() in Chrome, Firefox and Safari were returning 120 (2 hours), even though the operating system was set to -03:00.

For us, the problem has been completely eliminated after updating moment-timezone AND BROWSERS.

@DaniloSI
Copy link

DaniloSI commented Nov 6, 2019

@MassimilianoCarosi the current moment-timezone version is 0.5.27 and uses TZDB 2019c.

Look at releases page: https://github.com/moment/moment-timezone/releases

image

About browsers, @leonardocouy is right too, because the browsers also had the wrong timezone in old versions.
Three days ago, if I ran new Date().getCurrentTimezone() in Chrome, Firefox and Safari were returning 120 (2 hours), even though the operating system was set to -03:00.

For us, the problem has been completely eliminated after updating moment-timezone AND BROWSERS.

It worked for me! Great! ㊗️

@alissonjdb
Copy link
Author

In this case the https://momentjs.com/timezone/ not updated with the last realease but in git hub is up to date.

Thank you very much guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests