| ... | ... | @@ -394,7 +394,9 @@ function addSnoozeDays(base: Date, days: number): Date { |
| 394 | 394 | /** |
| 395 | 395 | * Shared "snooze until" choices for every client. "This evening" only |
| 396 | 396 | * appears while it is meaningfully before evening; after that the calendar |
| 397 | | * choices start at "Tomorrow". |
| 397 | * choices start at "Tomorrow". Calendar presets that land on the same |
| 398 | * instant collapse: on Sundays "Tomorrow" and "Next week" are both Monday |
| 399 | * morning, so only "Tomorrow" is offered. |
| 398 | 400 | */ |
| 399 | 401 | export function resolveSnoozePresets(now: Date): ReadonlyArray<SnoozePreset> { |
| 400 | 402 | const inAnHour = new Date(now.getTime() + HOUR_MS); |
| ... | ... | @@ -434,12 +436,14 @@ export function resolveSnoozePresets(now: Date): ReadonlyArray<SnoozePreset> { |
| 434 | 436 | |
| 435 | 437 | const daysUntilMonday = (1 - now.getDay() + 7) % 7 || 7; |
| 436 | 438 | const nextWeek = snoozeAtHour(addSnoozeDays(now, daysUntilMonday), MORNING_HOUR); |
| 437 | | presets.push({ |
| 438 | | id: "next-week", |
| 439 | | label: "Next week", |
| 440 | | whenLabel: `${nextWeek.toLocaleDateString(undefined, { weekday: "short" })} ${snoozeTimeOfDayLabel(nextWeek)}`, |
| 441 | | snoozedUntil: nextWeek.toISOString(), |
| 442 | | }); |
| 439 | if (nextWeek.getTime() !== tomorrow.getTime()) { |
| 440 | presets.push({ |
| 441 | id: "next-week", |
| 442 | label: "Next week", |
| 443 | whenLabel: `${nextWeek.toLocaleDateString(undefined, { weekday: "short" })} ${snoozeTimeOfDayLabel(nextWeek)}`, |
| 444 | snoozedUntil: nextWeek.toISOString(), |
| 445 | }); |
| 446 | } |
| 443 | 447 | |
| 444 | 448 | return presets; |
| 445 | 449 | } |