Repository navigation
feat(search): filter events by a date range - #50
Merged
Merged
Conversation
Add a `dateRange` group to `EventFilters` — a start/end pair of optional `yyyy-MM-dd` calendar dates (both null = no restriction). `matchesFilters` applies it inside the per-occurrence `upcomingDates` loop, so one occurrence must satisfy weekday, time-of-day, and date-range together, read in the event's own frame via `eventTimeZone`. The `dates` URL param round-trips through the codec and is clamped to [today, today + 12 months]; a reversed or malformed value collapses to no restriction. `dateRange` is counted in `activeFilterCount` and keyed in `filtersKey`, and `useSetFilters` gains a `setDateRange`. `dateWindow()` is shared by the codec clamp and the picker. Updates the ActiveFilterPills story literal for the new required field. Closes #48 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
label / from / to / pill_from / pill_until / pill_range for the date
filter, in all 10 locales (cs de en es fr hu nl pt-BR ru uk). Ruby-style
%{} interpolation; no `count` variable (avoids i18next pluralization).
#48
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
SearchFilters gains a Date group: two native `<input type="date">` (From / To) bounded to [today, today + 12 months] via `dateWindow()`, with the To min following From and vice-versa, wired through the draft `patch` flow. ActiveFilterPills shows the applied range as one collapsed, removable pill (locale-aware luxon `DATE_MED`: "From …", "Until …", or "… – …") whose X clears the group via `setDateRange`. #48 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- filtersKey: pass `dateRange` directly instead of a redundant [start, end]
tuple — a DateRange is always {start, end}, so JSON.stringify is stable
(matches how timeOfDay is keyed).
- SearchFilters: extract a module-private DateBound for the From/To inputs
(mirrors the file's FilterGroup helper), so the input styling lives once.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
A native date input enforces its min/max only in the calendar UI, not for keyboard entry — so a typed out-of-window or reversed value could make the draft's live "Apply (N)" count disagree with the applied result (the URL codec clamps the window and collapses a reversed range on read). Clamp each typed value to the input's own [min, max] in DateBound so the draft stays in step with what applies. Found in the /code-review pass. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Deploying sahajatlas-design with
|
| Latest commit: |
3b80618
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://60bfb6ad.sahajatlas-design.pages.dev |
| Branch Preview URL: | https://feat-date-range-filter.sahajatlas-design.pages.dev |
An open-ended "until Y" date range (only the To date set) had no lower bound, so a stale- or timezone-shifted `upcomingDates` occurrence dated before today could still match — most visibly for an online event whose next occurrence reads as "yesterday" in the viewer's zone near midnight. Floor the lower bound at today in matchesFilters (a set start is already clamped to >= today), injecting `today` so the predicate stays pure and the map's hot path reads the clock once per feed rather than per feature. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Ardnived
added a commit
that referenced
this pull request
Jul 14, 2026
Brings in #49 (pin-hover highlight) and #50 (date-range filter). Two conflicts, resolved by combining both sides: - Map.tsx `filtered` memo + fetch.ts `getEvents`: keep #50's `today` arg to matchesFilters AND this branch's geometry-only toMapSource trim / per-locale titles join. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
14 tasks
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.
Summary
/filtersdrawer: pick a start and/or end date within the next 12 months and keep only events with an upcoming occurrence in that window. Like every other filter it lives in the URL (dates=…), so a dated view is linkable/shareable, and it drives the map, results list, active-filter pills, and the FilterButton badge through the singlematchesFilterspredicate.[today, today + 12 months], and an out-of-window / reversed / malformed value — whether hand-crafted in the URL or keyboard-typed into the input — is clamped or dropped, never trusted.filters.dates.*).Changes
src/lib/shape/filters.ts—dateRangegroup onEventFilters/DEFAULT_FILTERS(frozen),isDateRestricted, a shareddateWindow(), the per-occurrence date check insidematchesFilters(evaluated in the event's own timezone, together with day + time), the counts +filtersKey, and thedatesURL codec (parseDateswith the window clamp).src/hooks/use-filters.ts—setDateRange.src/components/molecules/SearchFilters/SearchFilters.tsx— a DateFilterGroupwith two native<input type="date">(module-privateDateBound), bounded and kept pair-valid.src/components/molecules/ActiveFilterPills/ActiveFilterPills.tsx— one collapsed, removable date pill.public/locales/*/common.json—filters.dates.*in all 10 locales.Verification
pnpm lint)pnpm typecheck)pnpm test:run), incl. new predicate coverage (range in/out, per-occurrence AND with day/time, timezone frames online/null-tz, empty-dates exclusion) and codec coverage (round-trip, open bounds, window clamp, reversed, malformed/non-canonical).pnpm build) and Ladle (pnpm ladle:build)Manual / visual verification
Verified in the running widget against the seeded backend:
/filters→ Date group renders with From/To native inputs bounded to today … today + 12 months.?dates=2026-07-20,2026-07-27and filters the list to events with an in-window occurrence — confirmed by per-occurrence semantics (e.g. a weekly Thursday event, next shown "Starting Jul 16", matches via its Jul 23 occurrence).dates=) and the FilterButton badge counts it ("Filters (1)").?locale=fr): heading "Date", inputs "Du" / "Au", pill "20 juil. 2026 – 27 juil. 2026" — localized, no raw keys.Notes for reviewer
yyyy-MM-ddstrings in the event's own frame (eventTimeZone: viewer zone for online,firstDate_tzotherwise, UTC for null-tz) — the same rule the existing day/time filters use; the filter bounds are viewer-local calendar dates. This is intentional and consistent with the other per-occurrence filters./simplifypass extracted theDateBoundhelper and dropped a redundant tuple infiltersKey; the/code-reviewpass added the keyboard-entry clamp (native date inputs enforce min/max only in the calendar UI, not for typed values). Two review nits were dismissed with reasons: the mixed-tz-frame is by design (matches the day/time filters), and the pill'sDATE_MED(which includes the year) is the format the issue specifies and disambiguates year-spanning ranges.src/views/FilterView/FilterView.tsxneeded no change (it already renders<SearchFilters>+ the Apply count).Closes #48
🤖 Generated with Claude Code