`formless usage` buckets by UTC day with no label or local-time option, so usage for non-UTC users lands on the wrong date

Open
#2,181 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
cli, databases

Research direction

Start with Store::usage_grouped and the UsageByDay input, then inspect the formless usage CLI path that builds the request and the existing usage grouping tests. Check how UTC timestamps and --since are handled before deciding which suggested behavior to implement. Done means the chosen day and cutoff behavior is explicit to CLI users and covered by a test, including the supplied UTC+7 example.

Written by the indexing model from the issue text.

Description

Problem

formless usage defaults to --by day, and Store::usage_grouped builds the day key as substr(u.created_at, 1, 10), using the stored UTC RFC 3339 timestamp. Every daily bucket is therefore a UTC day, but the human table just labels the column KEY with values like 2026-11-17 and never mentions UTC (only SPEC/the code comment do).

For anyone not on UTC this puts usage on the wrong day. For example, at UTC+7, everything from midnight to 07:00 local time is counted on the previous date. At UTC-5, evening work lands on the next date. "How much did I spend today?" gets the wrong answer, and the most recent row can look nearly empty for most of the local morning.

--since adds a related problem: the cutoff is now - DURATION, an exact instant, so with --since 7d the oldest day row covers only part of that day but looks like any other day.

Suggested fix

  • Bucket by the caller's local day. The CLI knows its UTC offset (chrono::Local), so it could send an optional utc_offset_minutes with UsageByDay, and usage_grouped would group by date(u.created_at, '+N minutes'). When the field is omitted, keep today's UTC behaviour for the TUI/web and old clients. (A fixed offset is wrong across a DST change; that's acceptable for a summary view, or the CLI could re-bucket per row.)
  • At minimum, title the day column DAY (UTC) in the human table so the current behaviour is visible.
  • For --by day --since D, either round the cutoff down to the start of that (local) day or mark the first row as partial.
  • Add a test with a row at 2026-11-16T20:00:00Z and offset +420 that expects key 2026-11-17.
Dominant language
Rust
Stars
0
Forks
0
Avg merge
12h 10m
Merged PRs (30d)
780

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from athiwatc/formless

All issues in athiwatc/formless

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.