When requesting the REST API we are getting datetimes in the RFC3339 format, for instance: 2024-09-04T06:03:34-03:00 This is retrieving the value that is stored DB, and using the timezone defined in the $KOHA_CONF file. However this format is not correctly into account when we search or, more importantly, when we create/update objects. Examples (Using the Buenos Aires timezome, which is UTC-3 "America/Argentina/Buenos_Aires"): 1. POST /api/v1/patrons with "due_date": "2024-09-09T23:59:00-00:00", And you will get "due_date": "2024-09-09T23:59:00-03:00", in DB: date_due: 2024-09-09 23:59:00
When requesting the REST API we are getting datetimes in the RFC3339 format, for instance: 2024-09-04T06:03:34-03:00 This is retrieving the value that is stored DB, and using the timezone defined in the $KOHA_CONF file. However this format is not correctly into account when we search or, more importantly, when we create/update objects. Examples (Using the Buenos Aires timezome, which is UTC-3 "America/Argentina/Buenos_Aires"): 1. POST /api/v1/checkouts with "due_date": "2024-09-09T23:59:00-00:00", And you will get "due_date": "2024-09-09T23:59:00-03:00", in DB: date_due: 2024-09-09 23:59:00
This should actually work in most places. It does not work however for checkouts because we are using AddIssue instead of the usual Koha::Object->new_from_api
(In reply to Jonathan Druart from comment #2) > This should actually work in most places. It does not work however for > checkouts because we are using AddIssue instead of the usual > Koha::Object->new_from_api It does not work, even on top of bug 37902: If I POST /api/v1/patrons "last_seen": "2024-09-12T03:29:05-04:00", response is "last_seen": "2024-09-12T03:29:05-03:00", and in DB: lastseen: 2024-09-12 03:29:05
Possible places affected: Koha/REST/V1/Authorities.pm * add (AddAuthority) * update (ModAuthority) Koha/REST/V1/Biblios/ItemGroups/Items.pm * add (why? No good reason it seems) Koha/REST/V1/Checkouts.pm * add (AddIssue) Koha/REST/V1/Clubs/Holds.pm * add Koha/REST/V1/Holds.pm * add (AddReserve) * edit (ModReserve) * suspend (certainly needs to be fixed) Koha/REST/V1/ILL/** Not reviewed
Using Koha::Object-based objects must be required for the REST API controllers.
Hi, I'm a bit confused here. I understand where this is coming from, but POST /checkouts doesn't have any datetime parameter that would get passed to AddIssue. So maybe this is a worse bug (e.g. in AddIssue).
(In reply to Jonathan Druart from comment #3) > (In reply to Jonathan Druart from comment #2) > > This should actually work in most places. It does not work however for > > checkouts because we are using AddIssue instead of the usual > > Koha::Object->new_from_api > > It does not work, even on top of bug 37902: > > If I POST /api/v1/patrons > > "last_seen": "2024-09-12T03:29:05-04:00", > response is > > "last_seen": "2024-09-12T03:29:05-03:00", > > and in DB: lastseen: 2024-09-12 03:29:05 To clarify, this is fixed by bug 37902: in $KOHA_CONF 403 <timezone>America/Argentina/Buenos_Aires</timezone> Without 37902: POST "last_seen": "2024-09-12T03:29:05-01:00", response "last_seen": "2024-09-12T03:29:05-03:00", DB has "2024-09-12 03:29:05" With 37902: POST "last_seen": "2024-09-12T03:29:05-01:00", response "last_seen": "2024-09-12T01:29:05-03:00", DB has "2024-09-12 01:29:05"
(In reply to Tomás Cohen Arazi from comment #6) > Hi, I'm a bit confused here. I understand where this is coming from, but > POST /checkouts doesn't have any datetime parameter that would get passed to > AddIssue. So maybe this is a worse bug (e.g. in AddIssue). Indeed! My test was wrong, I was assuming my parameter was taken into account but it's not! Tried today with POST "due_date": "2024-09-09T23:59:00-00:00", and the response is "due_date": "2024-09-22T23:59:00-03:00", (ie. it's ignored!) So it's a bug in the spec I guess, not related to DT handling.