(date, locale, options, format = 'long')
| 12 | * @private |
| 13 | */ |
| 14 | export function getTimeZoneName(date, locale, options, format = 'long') { |
| 15 | if (!Intl?.DateTimeFormat) { |
| 16 | return ''; |
| 17 | } |
| 18 | const formatter = new Intl.DateTimeFormat(locale, { |
| 19 | timeZone: options?.timeZone, |
| 20 | timeZoneName: format, |
| 21 | }); |
| 22 | const parts = formatter.formatToParts?.(date) || []; |
| 23 | for (const part of parts) { |
| 24 | if (part.type === 'timeZoneName') { |
| 25 | return part.value; |
| 26 | } |
| 27 | } |
| 28 | return ''; |
| 29 | } |
no outgoing calls
no test coverage detected