Mercurial > hg > orthanc
changeset 4611:dfb7429f0d48 db-changes
integration mainline->db-changes
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 02 Apr 2021 13:51:18 +0200 |
parents | 37de0a5ebe86 (current diff) 8661811abca3 (diff) |
children | 4982733a4e39 |
files | NEWS |
diffstat | 2 files changed, 21 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Wed Mar 31 14:35:48 2021 +0200 +++ b/NEWS Fri Apr 02 13:51:18 2021 +0200 @@ -19,6 +19,11 @@ * New functions in the SDK: - OrthancPluginCallRestApi() +Maintenance +----------- + +* Use the local timezone for query/retrieve in the Orthanc Explorer interface (was UTC before) + Version 1.9.1 (2021-02-25) ==========================
--- a/OrthancServer/OrthancExplorer/query-retrieve.js Wed Mar 31 14:35:48 2021 +0200 +++ b/OrthancServer/OrthancExplorer/query-retrieve.js Fri Apr 02 13:51:18 2021 +0200 @@ -31,18 +31,25 @@ **/ -function JavascriptDateToDicom(date) -{ - var s = date.toISOString(); - return s.substring(0, 4) + s.substring(5, 7) + s.substring(8, 10); -} - function GenerateDicomDate(days) { var today = new Date(); - var other = new Date(today); - other.setDate(today.getDate() + days); - return JavascriptDateToDicom(other); + var utc = new Date(today); + utc.setDate(today.getDate() + days); + + /** + * "utc" contains the date of interest, as selected by the user. + * Calling "utc.toISOString()" would return a date in the UTC + * timezone, whereas the user expects the date to be expressed in + * her own timezone. We thus adjust from UTC to the local timezome. + * https://stackoverflow.com/a/50537435 + * https://groups.google.com/g/orthanc-users/c/dK7EEPVpedk/m/DPtMRFnKAgAJ + **/ + var timezoneOffset = today.getTimezoneOffset() * 60 * 1000; + var localDate = new Date(utc.getTime() - timezoneOffset); + + var s = localDate.toISOString(); + return s.substring(0, 4) + s.substring(5, 7) + s.substring(8, 10); }