Skip to content

feat: add --until, today/yesterday keywords; harmonize date flags#8

Merged
DTTerastar merged 1 commit into
mainfrom
feat/until-flag-and-keyword-dates
Apr 25, 2026
Merged

feat: add --until, today/yesterday keywords; harmonize date flags#8
DTTerastar merged 1 commit into
mainfrom
feat/until-flag-and-keyword-dates

Conversation

@DTTerastar
Copy link
Copy Markdown
Contributor

Summary

Part 2 of 3 in cross-repo date-flag harmonization across the quantcli export CLIs. Aligns this CLI with the shared contract at quantcli/common/CONTRACT.md §3.

```
--since VALUE inclusive lower bound
--until VALUE inclusive upper bound (new)
VALUE: today | yesterday | YYYY-MM-DD | Nd/Nw/Nm/Ny
```

Wired through activity, sleep, workouts, measurements, intraday. ymd-format API params (`enddateymd`) get the inclusive end day; epoch params (`enddate`) get the exclusive moment. The `sleep --derive` iteration loop respects `--until` instead of always running to `time.Now()`.

One semantic change worth flagging

`--since 30d` previously meant "30 days ago at this exact moment" (`time.Now().AddDate(0,0,-30)`). It now means "midnight of the day 30 calendar days ago". Same as how `--since 2025-01-01` already worked. Matches user intent better — running the same command at 11:59pm vs 12:01am should not return different windows.

Test plan

  • `go build ./...`, `go vet ./...`, `go test ./...` pass
  • `activity --since yesterday --until today` returns yesterday's activity row
  • Bad value (`measurements --since lol`) gives clear error
  • `sleep --help` shows updated flag descriptions

Cross-repo status

  • liftoff-export-cli: #17 (open)
  • crono-export-cli: pending — bigger refactor (drops `--today`/`--days`/`--start`/`--end`)

🤖 Generated with Claude Code

Aligns withings-export with the shared quantcli date-flag contract
(https://github.com/quantcli/common/blob/main/CONTRACT.md#3-date-flags):

  --since VALUE   inclusive lower bound
  --until VALUE   inclusive upper bound (new)

  VALUE: today | yesterday | YYYY-MM-DD | Nd/Nw/Nm/Ny

Wired through every subcommand that selects a window of data: activity,
sleep, workouts, measurements, intraday. ymd-format API params get the
inclusive end day; epoch params get the exclusive moment.

The sleep --derive iteration loop now respects --until instead of always
running to time.Now().

Side effect: relative durations now snap to local midnight. --since 30d
previously meant "30 days ago at this exact moment", which made the same
command return slightly different results depending on the time of day.
It now means "midnight of the day 30 calendar days ago", which matches
how absolute dates already worked.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant