Moment-timezone: Sao Paulo timezone is ahead by 1 hour

Created on 11 Dec 2019  路  2Comments  路  Source: moment/moment-timezone

We are using moment.js and HighCharts library to plot the data points on the graphs. When we try to plot the data points with other timezone, it is plotting correctly. Where as when we change the timezone to Sao Paulo, it is showing the data points as one hour ahead of the current time. We have updated the moment.js to the latest as of reference with the thread opened at https://github.com/moment/moment-timezone/issues/399. But it was of no help. The code we have used to convert to the user time zone is as follows,

time: {
          timezone: $('#user-timezone').val()
        },

Most helpful comment

@fazeela-veolia I just tried the latest version and America/Sao_Paulo looks ok

All 2 comments

EDIT: I am sorry, I did not had the latest version of Moment Timezone. I downloaded it from the momentjs.com website, but that is an old version. I downloaded now the latest version (0.5.27) from, Github releases and this fixed our issue.

We also still have this issue after upgrading to the latest version. Sao Paulo time is one hour ahead, probably due to DST.

Example code:

function toTimeZone(utc_date, format){
       var zone = 'America/Sao_Paulo';
       return moment(utc_date).tz(zone).format(format);
}

function getDateTime(){
    var time = moment.utc().format();
    return toTimeZone(time, 'L LTS');
}

console.log(getDateTime());

@fazeela-veolia I just tried the latest version and America/Sao_Paulo looks ok

Was this page helpful?
0 / 5 - 0 ratings

Related issues

edu2004eu picture edu2004eu  路  6Comments

guidsen picture guidsen  路  4Comments

im1dermike picture im1dermike  路  4Comments

casper5822 picture casper5822  路  5Comments

rjpedrosa picture rjpedrosa  路  5Comments