Files
t3code/apps/mobile/src/features/threads/customSnoozeDate.ts
T

17 lines
651 B
TypeScript

/** Compose calendars exchange calendar days at UTC midnight, not local instants. */
export function snoozeDateToPickerDate(date: Date): string {
return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())).toISOString();
}
export function applySnoozePickerDate(date: Date, selected: Date): Date {
const next = new Date(date);
next.setFullYear(selected.getUTCFullYear(), selected.getUTCMonth(), selected.getUTCDate());
return next;
}
export function applySnoozePickerTime(date: Date, selected: Date): Date {
const next = new Date(date);
next.setHours(selected.getHours(), selected.getMinutes(), 0, 0);
return next;
}