1'use strict';
2
3const common = require('../common');
4const { isMainThread } = require('worker_threads');
5
6if (!common.hasIntl)
7  common.skip('Intl not present.');
8
9if (!isMainThread)
10  common.skip('Test not support running within a worker');
11
12const assert = require('assert');
13
14const cases = [
15  {
16    timeZone: 'Etc/UTC',
17    expected: /Coordinated Universal Time/,
18  },
19  {
20    timeZone: 'America/New_York',
21    expected: /Eastern (?:Standard|Daylight) Time/,
22  },
23  {
24    timeZone: 'America/Los_Angeles',
25    expected: /Pacific (?:Standard|Daylight) Time/,
26  },
27  {
28    timeZone: 'Europe/Dublin',
29    expected: /Irish Standard Time|Greenwich Mean Time/,
30  },
31];
32
33for (const { timeZone, expected } of cases) {
34  process.env.TZ = timeZone;
35  const date = new Date().toLocaleString('en-US', { timeZoneName: 'long' });
36  assert.match(date, expected);
37}
38