summaryrefslogtreecommitdiff
path: root/test/parallel/test-datetime-change-notify.js
blob: 01843511907077857be22c9bc7e7f8568fc677d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'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);
}