[Bug 24650] New: API returned timestamps are incompatible with existing helpers
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24650 Bug ID: 24650 Summary: API returned timestamps are incompatible with existing helpers Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: andrew.isherwood@ptfs-europe.com QA Contact: testopia@bugs.koha-community.org API endpoints that return system maintained timestamps (specified as datetime in the DB schema and specified as 'date-time' in the endpoint definition) return the timestamps as a form of RFC3339 timestamps. For example, from the GET /patrons/{patron_id} response: "last_seen": "2020-02-13T08:47:29+00:00" This is good as it's in a standard form. However, all the existing handlers in koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc that are used to transform a received timestamp into the instance's defined format are expecting timestamps in the format: (see DateTime_from_syspref) [datestring] [hours:minutes] Thereby making it impossible to display a returned timestamp to the user in their chosen format. We either need to create additional helpers or modify the API returning of ISO formatted timestamps to something the helpers can cope with. -- 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=24650 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24650 --- Comment #1 from Andrew Isherwood <andrew.isherwood@ptfs-europe.com> --- Actually, it's not exclusively "system maintained" timestamps, it's anything defined as datetime in the DB -- 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=24650 --- Comment #2 from Andrew Isherwood <andrew.isherwood@ptfs-europe.com> --- Looking into this further it seems I have *completely* misunderstood the purpose of the *_from_syspref functions in calendar.inc. It would appear they accept a date / datetime in the format specified in the syspref, and return a Datetime. Much the same as Date.parse() will do. In which case, it would seem we're missing functions to take an ISO formatted datetime and return it in the format specified in the syspref. -- 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=24650 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- 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=24650 --- Comment #3 from Andrew Isherwood <andrew.isherwood@ptfs-europe.com> --- Created attachment 98818 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=98818&action=edit Bug 24650: Convert ISO datetimes to syspref dates This patch adds a function 'ISO_to_syspref' that accepts an ISO8601 / RFC3339 formatted timestamp, as returned from the API for datetime DB columns, and returns a string formatted according to the 'dateformat' syspref, optionally including the time Test plan: - Apply the patch - Load a page that uses calendar.inc, for example a patron's loan list in the staff interface - In the JS console, type the following and notice the printed date is in the format according to the syspref: var dt = new Date; console.log(ISO_to_syspref(dt.toISOString())); - In the JS console, type the following and notice the printed date is in the format according to the syspref, and includes the time: console.log(ISO_to_syspref(dt.toISOString(), true)); -- 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=24650 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |24609 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24609 [Bug 24609] Add routes for getting and setting checkout due 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=24650 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on|24609 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24609 [Bug 24609] Add routes for getting and setting checkout due date -- 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=24650 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |24608 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24608 [Bug 24608] Allow modification of checkout due date -- 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=24650 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- 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=24650 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #98818|0 |1 is obsolete| | --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 99061 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=99061&action=edit Bug 24650: Convert ISO datetimes to syspref dates This patch adds a function 'ISO_to_syspref' that accepts an ISO8601 / RFC3339 formatted timestamp, as returned from the API for datetime DB columns, and returns a string formatted according to the 'dateformat' syspref, optionally including the time Test plan: - Apply the patch - Load a page that uses calendar.inc, for example a patron's loan list in the staff interface - In the JS console, type the following and notice the printed date is in the format according to the syspref: var dt = new Date; console.log(ISO_to_syspref(dt.toISOString())); - In the JS console, type the following and notice the printed date is in the format according to the syspref, and includes the time: console.log(ISO_to_syspref(dt.toISOString(), true)); Signed-off-by: David Nind <david@davidnind.com> -- 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=24650 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |andrew.isherwood@ptfs-europ |ity.org |e.com CC| |katrin.fischer@bsz-bw.de --- Comment #5 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Andrew, please don't forget to fill out the Assignee when you start working on a bug! -- 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=24650 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=24455 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24650 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |BLOCKED CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #6 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- This is blocked until I understand the need and the link with bug 24455. Andrew, what is your real-life use case? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24650 --- Comment #7 from Andrew Isherwood <andrew.isherwood@ptfs-europe.com> --- Receiving ISO timestamps back from the API and needing to display them in the UI according to the format specified in the syspref -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24650 --- Comment #8 from Andrew Isherwood <andrew.isherwood@ptfs-europe.com> --- Looking at bug 24455, it looks like it may make this redundant -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24650 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|BLOCKED |In Discussion --- Comment #9 from Andrew Isherwood <andrew.isherwood@ptfs-europe.com> --- Setting this to "In discussion" because bug 24608 depends on it and having it "Blocked" prevents the QA of 24608. Although this bug is likely to be made redundant by bug 24455, that bug is still awaiting sign off, so in the meantime 24608 cannot be QA'ed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24650 --- Comment #10 from Andrew Isherwood <andrew.isherwood@ptfs-europe.com> --- Actually, that doesn't seem to help as git bz still doesn't pick it up as a dependency. I don't want to set it back to "Needs signoff", so I'll add a comment to bug 24608 noting that this bug needs to be manually applied. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24650 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|In Discussion |BLOCKED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24650 --- Comment #11 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- The best here would be to add to the discussion to push forward a solution (unblocking the depenencies). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24650 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|24608 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24608 [Bug 24608] Allow modification of checkout due date -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24650 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|BLOCKED |RESOLVED Resolution|--- |DUPLICATE --- Comment #12 from Andrew Isherwood <andrew.isherwood@ptfs-europe.com> --- Done. I have tested and signed off bug 24455, I've also switched my dependent bug 24608 to use that. I'll mark this as a duplicate. *** This bug has been marked as a duplicate of bug 24455 *** -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24650 Andrew Isherwood <bugzilla@warmlight.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|bugzilla@warmlight.co.uk |koha-bugs@lists.koha-commun | |ity.org -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org