From 14242d8574c67b5dfd4e293bd18615c56f857f51 Mon Sep 17 00:00:00 2001 From: gnezim Date: Mon, 20 Apr 2026 12:17:23 +0300 Subject: [PATCH] FlightsMapFilter: auto-fill date to today when departure picked (Angular parity) --- .claude/scheduled_tasks.lock | 1 + .dev.pid | 1 + .../flights-map/components/FlightsMapFilter.tsx | 10 ++++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .claude/scheduled_tasks.lock create mode 100644 .dev.pid diff --git a/.claude/scheduled_tasks.lock b/.claude/scheduled_tasks.lock new file mode 100644 index 00000000..54bd0f99 --- /dev/null +++ b/.claude/scheduled_tasks.lock @@ -0,0 +1 @@ +{"sessionId":"c83ad3f5-27f4-43e2-8c91-7793c8605d9c","pid":29547,"acquiredAt":1776638074373} \ No newline at end of file diff --git a/.dev.pid b/.dev.pid new file mode 100644 index 00000000..7c09f9fe --- /dev/null +++ b/.dev.pid @@ -0,0 +1 @@ +16440 diff --git a/src/features/flights-map/components/FlightsMapFilter.tsx b/src/features/flights-map/components/FlightsMapFilter.tsx index 92012117..70ed4f80 100644 --- a/src/features/flights-map/components/FlightsMapFilter.tsx +++ b/src/features/flights-map/components/FlightsMapFilter.tsx @@ -85,8 +85,14 @@ export const FlightsMapFilter: FC = ({ ); useEffect(() => { - if (!value.date) return; - const current = yyyymmddToDate(value.date); + // Mirrors Angular FlightsMapFiltersStateService.snapToNearestAvailable. + // With a date set, re-anchor it forward if it lands on a disabled day. + // With no date but a departure set, auto-fill to today (or next enabled + // day) — Angular runs snap from setDisabledDates after the calendar API + // responds, which seeds the input on first route selection. + if (!value.date && !value.departure) return; + + const current = value.date ? yyyymmddToDate(value.date) : new Date(); if (!current) return; const snapped = findNextEnabledDate(current, disabledDates, minDate, maxDate);