* Helper function to get a friendly timezone abbreviation. * Uses Intl.DateTimeFormat to get the correct abbreviation for the current time, * automatically handling DST transitions.
(timezone: string)
| 482 | * automatically handling DST transitions. |
| 483 | */ |
| 484 | function getTimezoneAbbreviation(timezone: string): string { |
| 485 | if (timezone === 'UTC') return 'UTC' |
| 486 | |
| 487 | try { |
| 488 | const formatter = new Intl.DateTimeFormat('en-US', { |
| 489 | timeZone: timezone, |
| 490 | timeZoneName: 'short', |
| 491 | }) |
| 492 | const parts = formatter.formatToParts(new Date()) |
| 493 | const tzPart = parts.find((p) => p.type === 'timeZoneName') |
| 494 | return tzPart?.value || timezone |
| 495 | } catch { |
| 496 | return timezone |
| 497 | } |
| 498 | } |
| 499 | |
| 500 | /** |
| 501 | * Converts a cron expression to a human-readable string format |
no outgoing calls
no test coverage detected