Bug 42868: Use local timezone instead of UTC when calculating start and end dates

To test:
1 - Edit koha-conf.xml
2 - Set timezone:
    <timezone>America/New_York</timezone>
3 - In Koha, enable bookings syspref
4 - Find a record, click the items tab, make an item bookable
5 - Place new booking, choose a date range
6 - View the bookings tab - note the booking extends into the date before
7- Check the DB, the start_date and end_date are wrong
8. APPLY PATCH, restart_all, clear browsewr cache
9. Place a new booking.
10. MariaDB [koha_kohadev]> select * from bookings WHERE booking_id={new booking}
11. Notice the start time should be {start_date} 00:00:00 and the end time should be {end_date} 23:59:59

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Lucas Gass 2026-06-24 15:11:56 +00:00 committed by Pedro Amorim
parent 50a5dcc4d4
commit 084660a6df
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 2 additions and 3 deletions

View File

@ -970,17 +970,16 @@ $("#placeBookingModal").on("show.bs.modal", function (e) {
);
$("#booking_start_date").val(
dayjs
.utc(startDate)
.tz(startDate, $timezone())
.startOf("day")
.toISOString()
);
$("#booking_end_date").val(
dayjs
.utc(endDate)
.tz(endDate, $timezone())
.endOf("day")
.toISOString()
);
// set available items in select2
let booked_items = bookings.filter(
function (booking) {