From 7b9cde1daf013287c412e6f8e7121b5d97b37084 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Tue, 30 Sep 2025 11:07:31 +0200 Subject: [PATCH] [Annotation] Fix some timezone issues when getting a date from the date picker (bug 1991584) --- src/display/annotation_layer.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index 126bb7131..4339d6284 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -1671,6 +1671,14 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement { ).valueOf(); target.step = ""; } else { + // Unfortunately, when the date is "2025-09-23", the parser + // converts it to UTC time which may lead to the date being off by + // one day depending on the timezone. To workaround this, we + // append "T00:00" to the date so that it's parsed as local + // time (bug 1989874). + if (!value.includes("T")) { + value = `${value}T00:00`; + } value = new Date(value).valueOf(); } target.type = "text";