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 {
const now = new Date();
const diffMs = resetAt.getTime() - now.getTime();
const hours = Math.max(0, Math.round(diffMs / (60 * 60 * 1000)));
const absolute = resetAt.toLocaleTimeString(undefined, {
const time = resetAt.toLocaleTimeString(undefined, {
hour: "numeric",
minute: "2-digit",
});
if (hours < 1) return `soon (${absolute})`;
if (hours === 1) return `in 1 hour (${absolute})`;
return `in ${hours} hours (${absolute})`;
const now = new Date();
const isSameDay =
resetAt.getFullYear() === now.getFullYear() &&
resetAt.getMonth() === now.getMonth() &&
resetAt.getDate() === now.getDate();
return `${isSameDay ? "today" : "tomorrow"} at ${time}`;
}
/**