FlightsMapFilter: auto-fill date to today when departure picked (Angular parity)

This commit is contained in:
2026-04-20 12:17:23 +03:00
parent 2ce6164b13
commit 14242d8574
3 changed files with 10 additions and 2 deletions
+1
View File
@@ -0,0 +1 @@
{"sessionId":"c83ad3f5-27f4-43e2-8c91-7793c8605d9c","pid":29547,"acquiredAt":1776638074373}
+1
View File
@@ -0,0 +1 @@
16440
@@ -85,8 +85,14 @@ export const FlightsMapFilter: FC<FlightsMapFilterProps> = ({
);
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);