[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
Sat Feb 15 11:58:39 CET 2020


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

David Nind <david at davidnind.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #98818|0                           |1
        is obsolete|                            |

--- Comment #4 from David Nind <david at 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 at davidnind.com>

-- 
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