Skip to content

fix(web): the token calendar never colors or counts a day after today - #1062

Merged
badcuban merged 1 commit into
mainfrom
fix/calendar-future-days
Nov 23, 2026
Merged

badcuban merged 1 commit into
mainfrom
fix/calendar-future-days

Conversation

@badcuban

Copy link
Copy Markdown
Collaborator

Usage dated after today (from a paired computer whose clock runs ahead) was colored in the token calendar's Daily mode and counted in weekly totals and the color scale. The calendar also fixed its "today" when the page opened, so a page left open overnight could miss the new day.

  • Today is the later of the browser's UTC day and the day the data was checked (tokenUsage.checkedAt), at most a day past the browser's.
  • It moves on at UTC midnight through useUtcDayStartMs, which shares the timer, focus and visibility handling of the sidebar's useLocalDayStartMs.
  • Days after today are blank in every mode and left out of week totals, running totals and the color scale.

Tested with a browser test pinned to a Monday. It checks that usage two days ahead isn't shown or counted, and that a page left open until Sunday shows Sunday's usage once new data arrives. It fails on the old code. Typecheck, lint, the web unit suite and the full browser suite pass.

Usage dated after today (from a paired computer whose clock runs ahead)
was colored in Daily mode and counted in weekly totals and the color
scale. The calendar also fixed its "today" when the page opened, so a
page left open overnight could miss the new day.

Today is now the later of the browser's UTC day and the day the data was
checked, at most a day past the browser's, and it moves on at UTC
midnight (useUtcDayStartMs, sharing the timer the sidebar's local-day
hook uses). Days after it are blank in every mode and left out of week
totals, running totals and the color scale.
@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
threadlines Skipped Skipped Nov 23, 2026 6:24pm UTC

Request Review

@badcuban
badcuban added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 7c8940d Nov 23, 2026
23 checks passed
@badcuban
badcuban deleted the fix/calendar-future-days branch November 23, 2026 18:36

This branch was previously deployed

1 inactive deployment
Preview — a52a01fc Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant