[Koha-bugs] [Bug 24650] API returned timestamps are incompatible with existing helpers

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Feb 13 13:34:45 CET 2020


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

--- Comment #3 from Andrew Isherwood <andrew.isherwood at 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.


More information about the Koha-bugs mailing list