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

--- Comment #137 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 209815
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209815&action=edit
Bug 42383: (QA follow-up) Restore the time and past-only return date

On the legacy returns page, the return date override took a time
(data-flatpickr-enable-time) and future dates could not be picked
(data-flatpickr-pastinclusive). The check-in page only offers a date,
which is sent as midnight, and allows dates in the future. The API
accepts any string as return_date, a future one included.

This patch addresses point 4 of comment #77:

- FlatPickrWrapper takes a 'config' prop, merged into the Koha
  flatpickr defaults
- The return date picker takes a time, displayed according to
  TimeFormat, and its maximum date is now (refreshed when it is
  opened). The data attributes read by the flatpickr defaults are set
  too, so the date and time input mask is used, 'Today' sets the
  current time, and 'Tomorrow' is disabled like on the legacy page
- The value sent to the API is a date-time without offset (e.g.
  2026-10-29T10:30:00), so it is in the Koha time zone, like the
  legacy page posted it. The 'Return date' badge displays the time
- POST /checkins declares return_date as a date-time, parses it as ISO
  (honouring the offset if any) and rejects a date in the future with
  a 400 and the 'return_date_in_future' error code, documented in the
  spec. The page displays a translatable message for it

Test plan:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ yarn api:bundle
  k$ yarn js:build
  k$ restart_all
3. Enable SpecifyReturnDate
4. Check out an item, go to Circulation > Check in and open the
   check-in settings
5. Open the return date picker
=> SUCCESS: Dates after today are disabled, and so is 'Tomorrow'
=> SUCCESS: A time can be picked, in the TimeFormat format
6. Pick yesterday at 10:30 and check the item in
=> SUCCESS: The 'Return date' badge shows the date and time
=> SUCCESS: The item is checked in, and the return date on the item's
   checkout history shows yesterday at 10:30
7. Run:
  k$ prove t/db_dependent/api/v1/checkins.t xt/api.t
=> SUCCESS: Tests pass!
  k$ yarn cypress run --spec t/cypress/integration/Circulation/Checkin_spec.ts
=> SUCCESS: Tests pass!
8. Sign off :-D

Assisted-by: Opus 5.5 (Anthropic)

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to