Repository navigation
feat: --since accepts relative durations (7d, 2w) - #8
Merged
emrehangorgec merged 2 commits intoOct 24, 2026
Merged
emrehangorgec merged 2 commits into
emrehangorgec merged 2 commits into
Conversation
Resolves them to the same YYYY-MM-DD string downstream, so filtering, the budget guard and the card's plan window stay unchanged. Invalid input (7x, 0d, -3d) keeps the existing error, now mentioning the relative form.
tokentimerch
force-pushed
the
feat/since-relative-durations
branch
from
October 24, 2026 13:51
1242b17 to
32c6722
Compare
Owner
|
thanks, looks good! pushed a small fix on top, really big values like 300000000d were crashing it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
Closes #4.
--sinceonly took an absoluteYYYY-MM-DDdate. The common case is "thelast week" or "the last 7 days", which meant working out and typing that
date yourself every time.
What
--sincenow also accepts a relative duration:<n>dor<n>w, resolvedto the UTC date
nunits ago, inclusive of today -7dcovers today andthe previous 6 days,
2wcovers today and the previous 13 days. Therelative form resolves to the same
YYYY-MM-DDstring the absolute formalready produced, so filtering, the budget guard, and the card's
--planproration are all untouched downstream of
resolveSince.Invalid input keeps failing with the original error message, extended to
mention the new form:
7x(bad suffix),0d(zero duration),-3d(negative), and any other non-match all fall through to
--since expects a valid date in YYYY-MM-DD format (UTC), or a relative duration like 7d or 2w.Help text and README updated next to the existing
--sincedocumentation.Verification
npx tsc --noEmitacross all three projects (src,scripts/tsconfig.json,test/tsconfig.json) - clean.npx vitest run- all passing except the five pre-existinggolden.test.tssnapshot failures, which reproduce unchanged onmainwith no code changes (ANSI color codes differ in this shell; unrelated to
this PR).
test/since.test.ts:7x,0d,0w,-3d,d,7,7dd,1.5d)7dboundary is included, one day older isexcluded
1wand7dproduce identical output