diff --git a/js/src/features/network-billing.tsx b/js/src/features/network-billing.tsx index 42df501..aa64153 100644 --- a/js/src/features/network-billing.tsx +++ b/js/src/features/network-billing.tsx @@ -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}`; } /**