Skip to content

--until alone (without --since) collapses to a 1-day window instead of [default-since, until] #18

Description

@DTTerastar

internal/cronoclient/daterange.go::resolveDateRange defaults to last-7-days only when both flags are empty:

if since.IsZero() && until.IsZero() {
    return DateRange{Start: today.AddDate(0, 0, -6), End: today}, nil
}
if until.IsZero() { until = today }
if since.IsZero() { since = until }   // <-- here

So --until 2026-04-20 (without --since) silently turns into a single-day query for 2026-04-20, not "the last 7 days ending 2026-04-20". This is surprising:

  • The no-flag default is a 7-day window.
  • Setting only --since extends the window to today (correct).
  • Setting only --until should symmetrically extend the window 7 days back from until, but instead shrinks it to a single day.

Repro:

$ /tmp/crono-export biometrics --until 7d
_(no records in window)_     # this is a 1-day query for the day 7 days ago, not a 7-day window

Expected: --until X alone -> [X-6d, X] (mirror of the default 7-day window). Document this in prime and in the flag help.

Severity: minor

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions