The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 03:37 UTC
| 1 | import * as DateTime from "effect/DateTime"; |
| 2 | |
| 3 | /** |
| 4 | * Short label for the server zone a fixed-time schedule runs in. With a run time it names |
| 5 | * that instant's offset (PST/PDT); without one it uses the generic name (PT). |
| 6 | */ |
| 7 | export function scheduleTimeZoneLabel( |
| 8 | timeZone: string | undefined, |
| 9 | runAt?: string | null, |
| 10 | ): string | undefined { |
| 11 | if (timeZone === undefined) return undefined; |
| 12 | if (timeZone === "Etc/UTC" || timeZone === "UTC" || timeZone === "GMT") return "UTC"; |
| 13 | try { |
| 14 | return new Intl.DateTimeFormat("en-US", { |
| 15 | timeZone, |
| 16 | timeZoneName: runAt ? "short" : "shortGeneric", |
| 17 | }) |
| 18 | .formatToParts(runAt ? DateTime.toEpochMillis(DateTime.makeUnsafe(runAt)) : undefined) |
| 19 | .find((part) => part.type === "timeZoneName")?.value; |
| 20 | } catch { |
| 21 | return undefined; |
| 22 | } |
| 23 | } |