fix: improve messaging for reset

Closes #163
This commit is contained in:
talksik
2026-04-14 19:04:54 -07:00
parent 226b284ad2
commit c2d0ed254b
+7 -7
View File
@@ -94,16 +94,16 @@ function CadenceOption({
} }
function formatResetLocal(resetAt: Date): string { function formatResetLocal(resetAt: Date): string {
const now = new Date(); const time = resetAt.toLocaleTimeString(undefined, {
const diffMs = resetAt.getTime() - now.getTime();
const hours = Math.max(0, Math.round(diffMs / (60 * 60 * 1000)));
const absolute = resetAt.toLocaleTimeString(undefined, {
hour: "numeric", hour: "numeric",
minute: "2-digit", minute: "2-digit",
}); });
if (hours < 1) return `soon (${absolute})`; const now = new Date();
if (hours === 1) return `in 1 hour (${absolute})`; const isSameDay =
return `in ${hours} hours (${absolute})`; resetAt.getFullYear() === now.getFullYear() &&
resetAt.getMonth() === now.getMonth() &&
resetAt.getDate() === now.getDate();
return `${isSameDay ? "today" : "tomorrow"} at ${time}`;
} }
/** /**