GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(usage): add month-to-date range by andersryanc · Pull Request #9108 · pingdotgg/t3code

Conversation

@andersryanc

@andersryanc andersryanc commented Sep 1, 2026 •
edited by macroscopeapp Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

What Changed

Added an MTD (month to date) option to the Usage page on web, desktop, and mobile.

The new range covers the first day of the current month through today using the user’s local time zone. Refreshing the page also recalculates the range when the day or month changes.

Why

The existing 30-day range is a rolling window, so it can include usage from the previous month. This makes it harder for API-billed users to estimate their current monthly spend.

MTD provides a calendar-aligned view of usage and estimated API costs for the current month.

UI Changes

Before

browser-screenshot-localhost-mtj73986

After

Usage page with MTD selected

Verification

  • Added coverage for month-to-date boundaries in the user’s local time zone
  • Existing Usage page tests pass
  • Shared, web, and mobile typechecks pass
  • Targeted lint and formatting checks pass

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Low Risk
Scoped UI and date-window helpers for usage display; no auth, billing, or data-pipeline changes beyond existing usage queries.

Overview
Adds an MTD period to Usage on web and mobile so totals and charts use the first day of the current calendar month through today in the viewer’s local time zone, instead of only rolling day windows.

Shared makeMonthToDateWindow builds that daily-resolution window (reusing makeWindow for “today” and timezone, then setting sinceDay to YYYY-MM-01). Period selectors now use a value of number | "mtd" with makeWindowForPeriod, including on refresh when the calendar day rolls over. Web period toggles/selects resolve options by string value so MTD is not coerced with Number(). User docs and a timezone-focused unit test cover the new range.

Reviewed by Cursor Bugbot for commit 2f15c83. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add month-to-date range option to usage screens

  • Adds makeMonthToDateWindow(now?) in usageFormat.ts which builds a daily-resolution window from the first day of the current month to today in the viewer's time zone
  • Updates the mobile and web usage screens to include an MTD option in the period selector, refactoring state from { days, window } to { period, window } where period is a union of numbers and 'mtd'
  • Introduces makeWindowForPeriod helper on both platforms that delegates to makeMonthToDateWindow() for MTD and preserves hourly resolution for 24h and daily resolution for other numeric ranges
  • Updates tests and usage.md to cover the new option
  • Behavioral Change: WINDOW_OPTIONS entries now use value instead of days; any code referencing the old days field on these options will need updating

Macroscope summarized 2f15c83.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@andersryanc
feat(usage): add month-to-date range
2f15c83
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Sep 1, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR adds a new month-to-date usage and estimated-cost view across web and mobile, backed by shared runtime date-window logic. Existing defaults remain unchanged, but the cross-surface production behavior and limited UI-level coverage merit human review.

You can add or adjust custom eligibility rules. Learn more.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge closed this Sep 7, 2026
@juliusmarminge

juliusmarminge commented Sep 7, 2026

Copy link
Copy Markdown
Member

Closing as part of the open-PR backlog sweep (wave 2).

Reason: Month-to-date range is subsumed by saphid usage custom-range stack #9014
Related: #9014

Reopen if this is still wanted and you’re willing to rebase onto current main.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@andersryanc @juliusmarminge
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.