| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 18f3ba3 commit c7a5857
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,14 +11,27 @@ if (!isMainThread) | |||
| 11 | 11 | ||
| 12 | 12 | const assert = require('assert'); | |
| 13 | 13 | ||
| 14 | - process.env.TZ = 'Etc/UTC'; | ||
| 15 | - assert.match(new Date().toString(), /GMT\+0000/); | ||
| 16 | - | ||
| 17 | - process.env.TZ = 'America/New_York'; | ||
| 18 | - assert.match(new Date().toString(), /Eastern (Standard|Daylight) Time/); | ||
| 19 | - | ||
| 20 | - process.env.TZ = 'America/Los_Angeles'; | ||
| 21 | - assert.match(new Date().toString(), /Pacific (Standard|Daylight) Time/); | ||
| 22 | - | ||
| 23 | - process.env.TZ = 'Europe/Dublin'; | ||
| 24 | - assert.match(new Date().toString(), /Irish/); | ||
| 14 | + const 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/, | ||
| 30 | + }, | ||
| 31 | + ]; | ||
| 32 | + | ||
| 33 | + for (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 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments