added demo quiz reset option. Added timer for next available daily quiz

This commit is contained in:
masongga
2026-05-24 07:48:51 -06:00
parent 4998576e64
commit 1a151b5c7c
6 changed files with 199 additions and 7 deletions

19
lib/date-keys.ts Normal file
View File

@@ -0,0 +1,19 @@
export function getTodayDateKey(date = new Date()) {
return date.toLocaleDateString("en-CA");
}
export function getNextLocalMidnight(from = new Date()) {
return new Date(
from.getFullYear(),
from.getMonth(),
from.getDate() + 1,
0,
0,
0,
0,
);
}
export function getMillisecondsUntilLocalMidnight(from = new Date()) {
return Math.max(0, getNextLocalMidnight(from).getTime() - from.getTime());
}