[Bug 37903] New: Timezone ignored when passing rfc3339 formatted date (POST, PUT, PATCH)
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37903 Bug ID: 37903 Summary: Timezone ignored when passing rfc3339 formatted date (POST,PUT,PATCH) Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: jonathan.druart@gmail.com QA Contact: testopia@bugs.koha-community.org CC: tomascohen@gmail.com 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 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37903 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |37831 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37831 [Bug 37831] [OMNIBUS] Timezone ignored when passing rfc3339 formatted date -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37903 --- Comment #1 from Jonathan Druart <jonathan.druart@gmail.com> --- 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 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37903 --- Comment #2 from Jonathan Druart <jonathan.druart@gmail.com> --- 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 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37903 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com --- Comment #3 from Jonathan Druart <jonathan.druart@gmail.com> --- (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 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37903 --- Comment #4 from Jonathan Druart <jonathan.druart@gmail.com> --- 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 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37903 --- Comment #5 from Jonathan Druart <jonathan.druart@gmail.com> --- Using Koha::Object-based objects must be required for the REST API controllers. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37903 --- Comment #6 from Tomás Cohen Arazi <tomascohen@gmail.com> --- 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). -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37903 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |37902 --- Comment #7 from Jonathan Druart <jonathan.druart@gmail.com> --- (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" Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37902 [Bug 37902] Timezone ignored when passing rfc3339 formatted date (search 'q') -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37903 --- Comment #8 from Jonathan Druart <jonathan.druart@gmail.com> --- (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. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37903 Bug 37903 depends on bug 37902, which changed state. Bug 37902 Summary: Timezone ignored when passing rfc3339 formatted date (search 'q') https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37902 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org