The best way to control Claude Code, Codex and more from any computer or phone

main
ts 28 lines 1.03 KB
Raw
1 /** Compose calendars exchange calendar days at UTC midnight, not local instants. */
2 export function snoozeDateToPickerDate(date: Date): string {
3 return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())).toISOString();
4 }
5
6 export function applySnoozePickerDate(date: Date, selected: Date): Date {
7 const next = new Date(date);
8 next.setFullYear(selected.getUTCFullYear(), selected.getUTCMonth(), selected.getUTCDate());
9 return next;
10 }
11
12 export function applySnoozePickerTime(date: Date, selected: Date): Date {
13 const next = new Date(date);
14 next.setHours(selected.getHours(), selected.getMinutes(), 0, 0);
15 return next;
16 }
17
18 /** Format the segment labels without changing the device's hour-cycle setting. */
19 export function snoozePickerLabels(date: Date, locale: string, is24Hour: boolean) {
20 return {
21 date: date.toLocaleDateString(locale, { month: "short", day: "numeric" }),
22 time: date.toLocaleTimeString(locale, {
23 hour: "numeric",
24 minute: "2-digit",
25 hourCycle: is24Hour ? "h23" : "h12",
26 }),
27 };
28 }