fix: harden reminder scheduler dedupe and boundary timing (#319)

* fix: harden reminder scheduler dedupe and boundary timing

* fix(ci): align medications route formatting with biome
This commit is contained in:
Daniel Volz
2026-02-25 22:15:35 +01:00
committed by GitHub
parent aa29d1c699
commit dbdf3b61cb
3 changed files with 179 additions and 130 deletions
+5 -1
View File
@@ -122,7 +122,11 @@ export function getNextScheduledTime(reminderHour: number, tz?: string): Date {
/** Calculate milliseconds until next check at the given reminder hour */
export function getMsUntilNextCheck(reminderHour: number, tz?: string): number {
const next = getNextScheduledTime(reminderHour, tz);
return next.getTime() - Date.now();
const msUntilNext = next.getTime() - Date.now();
if (msUntilNext <= 0) {
return msUntilNext + 24 * 60 * 60 * 1000;
}
return msUntilNext;
}
// =============================================================================