Skip to content

Commit 57a05a5

Browse files
jwfingclaude
andcommitted
insta usage: label the window as the billing cycle (inclusive end date)
The usage window now defaults to the current billing cycle; show it as 'billing cycle <start> → <end-1d>' (to is the exclusive next-cycle start). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent c464fb4 commit 57a05a5

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/commands/metrics.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ export async function usage(opts: { from?: string; to?: string; json?: boolean }
3232
const p = await requireProject()
3333
const res = await api.request('GET', `/projects/${p.projectId}/usage${qs({ from: opts.from, to: opts.to })}`)
3434
if (opts.json) return printJson(res)
35-
info(`usage ${new Date(res.from * 1000).toISOString().slice(0, 10)}${new Date(res.to * 1000).toISOString().slice(0, 10)}`)
35+
// Window defaults to the current billing cycle. `to` is the exclusive next-cycle start, so show
36+
// the inclusive last day (to − 1 day) — e.g. an org created on the 5th reads "…-05 → …next-04".
37+
const day = (sec: number) => new Date(sec * 1000).toISOString().slice(0, 10)
38+
info(`billing cycle ${day(res.from)}${day(res.to - 86400)}`)
3639
if (!res.dimensions?.length) return info('(no usage recorded)')
3740
for (const d of res.dimensions) {
3841
const label = DIMENSION_LABEL[d.dimension] ?? d.dimension

0 commit comments

Comments
 (0)