FlightsMapFilter: auto-fill date to today when departure picked (Angular parity)
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{"sessionId":"c83ad3f5-27f4-43e2-8c91-7793c8605d9c","pid":29547,"acquiredAt":1776638074373}
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user