Skip to content

feat: add --from/--to date range filtering to events list#2

Open
junior-ricon wants to merge 5 commits into
pimalaya:masterfrom
junior-ricon:feat/time-range-filter
Open

feat: add --from/--to date range filtering to events list#2
junior-ricon wants to merge 5 commits into
pimalaya:masterfrom
junior-ricon:feat/time-range-filter

Conversation

@junior-ricon

Copy link
Copy Markdown

Summary

  • Add --from and --to flags to calendula events list for server-side date filtering
  • Thread TimeRange from io-calendar through CaldavClient and Client
  • Either flag can be used independently (open-ended ranges)

Depends on: pimalaya/io-calendar#1

Usage

# Events this week
calendula events list calendar --from 2026-02-14 --to 2026-02-21

# All events from today onwards
calendula events list calendar --from 2026-02-14

# All events up to a deadline
calendula events list calendar --to 2026-03-01

Changes

  • src/event/command/list.rs — Parse --from/--to as NaiveDate, convert to TimeRange, call list_events_in_range() when present
  • src/client.rs — Add list_events_in_range() that delegates to backend
  • src/caldav/client.rs — Add list_events_in_range() using ListCalendarItems::with_time_range()
  • Cargo.toml — Point io-calendar at fork (temporary, until io-calendar PR merges)

Test plan

  • events list calendar without flags still works (no regression)
  • events list calendar --from 2026-02-14 --to 2026-02-21 returns only events in range
  • events list calendar --from 2026-02-14 returns events from that date onwards
  • events list calendar --to 2026-03-01 returns events up to that date
  • --help shows the new flags with descriptions

junior-ricon and others added 2 commits February 14, 2026 03:54
Thread io-calendar's new TimeRange through the client stack so
`calendula events list <calendar> --from 2026-02-14 --to 2026-02-21`
sends a CalDAV calendar-query REPORT with <C:time-range> filter,
letting the server return only events in the requested range.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove sentinel dates, use Option fields from io-calendar's TimeRange
- Import TimeRange from public re-export path (io_calendar::caldav)
- Add warning when vdir backend ignores date filtering

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@junior-ricon

Copy link
Copy Markdown
Author

Updated based on review feedback from two colleagues:

  • Removed sentinel dates (99991231T235959Z, 19700101T000000Z) — now that io-calendar's TimeRange has Option fields, open-ended ranges are expressed cleanly.
  • Updated import path to use the public re-export (io_calendar::caldav::TimeRange) instead of reaching into internal modules.
  • Added warning for vdir backend — logs when date filtering flags are used with a backend that doesn't support server-side filtering.

junior-ricon and others added 2 commits February 14, 2026 04:49
--to now includes events on the specified date (shifts end bound to
the next day for CalDAV). Uses the validated TimeRange::new()
constructor instead of struct literal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ests

- Extract time-range building into a testable function
- Replace silent unwrap_or fallback with explicit error for out-of-range --to
- Add 6 tests covering inclusive --to semantics, month/year boundaries,
  and both-None case

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@junior-ricon junior-ricon marked this pull request as ready for review February 19, 2026 03:19
@junior-ricon

Copy link
Copy Markdown
Author

Final updates after three rounds of internal review:

  • --to is now inclusive--to 2026-02-21 includes events on Feb 21 (internally shifts end bound to next day)
  • Explicit error on date overflow instead of silent fallback
  • Extracted build_time_range into a testable function
  • 6 unit tests covering inclusive semantics, month/year boundaries, and edge cases

Note: Cargo.toml still points at the io-calendar fork — needs to be reverted once pimalaya/io-calendar#1 merges.

The Cargo.toml patch was temporarily pointing at our fork during
development. Revert to upstream — this PR depends on
pimalaya/io-calendar#1 being merged first.

Co-Authored-By: Claude Opus 4.6 <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