What happened?
ccusage session and ccusage pi session disagree about which pi sessions fall inside the same date window.
The unified report filters pi sessions by comparing the session's lastActivity against the --until date as strings. lastActivity is a full RFC3339 timestamp, so after dash removal a session at 2026-07-04T18:00:00Z becomes 20260704T180000Z, which sorts after 20260704 — and the session gets dropped even though it's on the until day. The pi session --pi-path path filters entries by date before summarizing, so it keeps the session.
Concretely, against the same store:
ccusage session --json -u 20260704 # pi session from 2026-07-04 missing
ccusage pi session --json -u 20260704 # same session present
Steps to reproduce
- Have a pi session whose last activity is on day X (e.g.
2026-07-04T18:00:00Z).
- Run
ccusage session --json -u 20260704 — the session is missing from the unified output.
- Run
ccusage pi session --json -u 20260704 — the session is there.
Expected behavior
--until is inclusive everywhere. The unified report should return the same pi sessions as the pi subcommand for the same window.
Version
v20.0.14 (also reproduced on current main)
I have a fix ready (filter entries by date before summarizing, same as the pi subcommand does) with a regression test that fails on main and passes with the fix. Happy to open a PR.
What happened?
ccusage sessionandccusage pi sessiondisagree about which pi sessions fall inside the same date window.The unified report filters pi sessions by comparing the session's
lastActivityagainst the--untildate as strings.lastActivityis a full RFC3339 timestamp, so after dash removal a session at2026-07-04T18:00:00Zbecomes20260704T180000Z, which sorts after20260704— and the session gets dropped even though it's on the until day. Thepi session --pi-pathpath filters entries by date before summarizing, so it keeps the session.Concretely, against the same store:
Steps to reproduce
2026-07-04T18:00:00Z).ccusage session --json -u 20260704— the session is missing from the unified output.ccusage pi session --json -u 20260704— the session is there.Expected behavior
--untilis inclusive everywhere. The unified report should return the same pi sessions as the pi subcommand for the same window.Version
v20.0.14 (also reproduced on current main)
I have a fix ready (filter entries by date before summarizing, same as the pi subcommand does) with a regression test that fails on main and passes with the fix. Happy to open a PR.