Skip to content
Source
Sign inSign up
Open History to see the last commit

customSnoozeDate.ts

16 lines651 Bytes

1/** Compose calendars exchange calendar days at UTC midnight, not local instants. */
2export function snoozeDateToPickerDate(date: Date): string {
3 return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())).toISOString();
4}
5​
6export 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;
11​
12export 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;