Skip to content

NodeJS reports incorrect time zone for Brazil #30211

Closed
@albertyw

Description

  • Version: v13.0.1
  • Platform: Darwin 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019
  • Subsystem: N/A

Node is reporting the wrong time zone for Brazil after its cancelled daylight savings change on November 2.

Reproduction:

var process = require('process');
console.log('ICU version: ' + process.versions.icu);

var options = {
    timeZone: "America/Sao_Paulo",
    year: 'numeric', month: 'numeric', day: 'numeric',
    hour: 'numeric', minute: 'numeric', second: 'numeric',
    timeZoneName: 'short'
};

var formatter = new Intl.DateTimeFormat([], options);

var UTCTimeBefore = new Date(new Date().toUTCString());
var UTCTimeAfter = new Date(UTCTimeBefore.getTime() + (7 * 24 * 60 * 60 * 1000));
var UTCTimeAfter = new Date(UTCTimeBefore.getTime() + (30 * 24 * 60 * 60 * 1000));
var localTime = formatter.format(UTCTimeBefore);
console.log('Should be GMT-3')
console.log(localTime);
var localTime = formatter.format(UTCTimeAfter);
console.log('Should also be GMT-3')
console.log(localTime);

Outputs:

ICU version: 64.2
Should be GMT-3
11/1/2019, 7:19:15 PM GMT-3
Should also be GMT-3
12/1/2019, 8:19:15 PM GMT-2

I believe this is because node v13.0.1 depends on ICU version 64.2 which includes tzdata 2019a. However, brazil's updated daylight savings was added in tzdata 2019b, which requires a minimum ICU version of 65.1.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions