[Annotation] Fix some timezone issues when getting a date from the date picker (bug 1991584)

This commit is contained in:
Calixte Denizet 2025-09-30 11:07:31 +02:00
parent e3a5f61234
commit 7b9cde1daf

View File

@ -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";