11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../common');
41cb0ef41Sopenharmony_ciconst { isMainThread } = require('worker_threads');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciif (!common.hasIntl)
71cb0ef41Sopenharmony_ci  common.skip('Intl not present.');
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciif (!isMainThread)
101cb0ef41Sopenharmony_ci  common.skip('Test not support running within a worker');
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ciconst assert = require('assert');
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ciconst cases = [
151cb0ef41Sopenharmony_ci  {
161cb0ef41Sopenharmony_ci    timeZone: 'Etc/UTC',
171cb0ef41Sopenharmony_ci    expected: /Coordinated Universal Time/,
181cb0ef41Sopenharmony_ci  },
191cb0ef41Sopenharmony_ci  {
201cb0ef41Sopenharmony_ci    timeZone: 'America/New_York',
211cb0ef41Sopenharmony_ci    expected: /Eastern (?:Standard|Daylight) Time/,
221cb0ef41Sopenharmony_ci  },
231cb0ef41Sopenharmony_ci  {
241cb0ef41Sopenharmony_ci    timeZone: 'America/Los_Angeles',
251cb0ef41Sopenharmony_ci    expected: /Pacific (?:Standard|Daylight) Time/,
261cb0ef41Sopenharmony_ci  },
271cb0ef41Sopenharmony_ci  {
281cb0ef41Sopenharmony_ci    timeZone: 'Europe/Dublin',
291cb0ef41Sopenharmony_ci    expected: /Irish Standard Time|Greenwich Mean Time/,
301cb0ef41Sopenharmony_ci  },
311cb0ef41Sopenharmony_ci];
321cb0ef41Sopenharmony_ci
331cb0ef41Sopenharmony_cifor (const { timeZone, expected } of cases) {
341cb0ef41Sopenharmony_ci  process.env.TZ = timeZone;
351cb0ef41Sopenharmony_ci  const date = new Date().toLocaleString('en-US', { timeZoneName: 'long' });
361cb0ef41Sopenharmony_ci  assert.match(date, expected);
371cb0ef41Sopenharmony_ci}
38