0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-datetime-change-notify.js
Piotr Rybak 747ef34fb0 test: fix test-datetime-change-notify after daylight change
Add standard timezone name for Dublin without daylight saving

PR-URL: https://github.com/nodejs/node/pull/40684
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Voltrex <mohammadkeyvanzade94@gmail.com>
2021-11-01 09:28:33 -07:00

38 lines
851 B
JavaScript

'use strict';
const common = require('../common');
const { isMainThread } = require('worker_threads');
if (!common.hasIntl)
common.skip('Intl not present.');
if (!isMainThread)
common.skip('Test not support running within a worker');
const assert = require('assert');
const cases = [
{
timeZone: 'Etc/UTC',
expected: /Coordinated Universal Time/,
},
{
timeZone: 'America/New_York',
expected: /Eastern (?:Standard|Daylight) Time/,
},
{
timeZone: 'America/Los_Angeles',
expected: /Pacific (?:Standard|Daylight) Time/,
},
{
timeZone: 'Europe/Dublin',
expected: /Irish Standard Time|Greenwich Mean Time/,
},
];
for (const { timeZone, expected } of cases) {
process.env.TZ = timeZone;
const date = new Date().toLocaleString('en-US', { timeZoneName: 'long' });
assert.match(date, expected);
}