Commit Graph

1 Commits

Author SHA1 Message Date
Supra4E8C ddabc99e24 feat(quota): add a shared minute clock and signed relative-time formatting
Relative time goes stale on its own — nothing re-renders when a minute
passes, so a long-lived tab silently lies. The naive fix is a timer per
component, which on the quota page means one per card body.

Adds one app-wide clock instead, started on the first subscriber and
cleared on the last, exposed through useNow(). QuotaTimeline drops its
private interval and joins it, so the chart and the cards above it tick
in lockstep.

Also extracts the timeline's private relative-time formatter into a
shared, testable one. It is now signed: the old version clamped with
Math.max(0, …), so a credit that expired last week read "in 1 minute".

Duration constants and the MM-DD HH:mm shape are deduplicated into
utils/time/durations.ts and formatInstantShort, which the existing
formatQuotaResetTime / formatUnixSeconds now delegate to.
2026-08-02 01:54:19 +08:00