MCPcopy Index your code
hub / github.com/simstudioai/sim / getTimezoneAbbreviation

Function getTimezoneAbbreviation

apps/sim/lib/workflows/schedules/utils.ts:484–498  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

482 * automatically handling DST transitions.
483 */
484function 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

Callers 1

parseCronToHumanReadableFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected