https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39916

--- Comment #41 from Paul Derscheid <[email protected]> ---
Created attachment 192265
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=192265&action=edit
Bug 39916: (QA follow-up) Fix startRange class lost on month navigation

When selecting a booking start date that triggers month navigation
(e.g., selecting Feb 1 while viewing January), the flatpickr calendar
would lose the 'startRange' CSS class on the selected date. This
occurred because setting maxDate in the onChange handler triggered a
calendar redraw, and flatpickr only applies startRange during the
initial click event, not during redraws.

This caused the Cypress test "should handle date range validation
correctly" to fail on dates near month boundaries (e.g., January 30).

The fix re-applies the startRange class after the maxDate is set,
using setTimeout to ensure it runs after the redraw completes. A
guard ensures this only happens when exactly one date is selected,
preventing interference with end date selection.

To test:
- Apply patch
- Open a biblio detail page with bookable items
- Click "Place booking"
- Select a patron, pickup location, and item
- In the date picker, click a date that's in the next month
  (visible in the "next month" area of the calendar)
- Verify the selected date shows the startRange styling (highlighted
  as the range start)
- Select an end date
- Verify the range is properly selected and the form can be submitted
- Run Cypress tests:
  yarn cypress run --spec
t/cypress/integration/Circulation/bookingsModalDatePicker_spec.ts
- Verify all tests pass

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to