webmail: fix parsing search filter "start:<date>" and "end:<date>"

we were only properly parsing values of "<date>T<time>" or just "<time>".
so you could select a date in the form (or type it), but it would be treated as
just a word of text to search for in messages. so it would quietly do the wrong
thing.
This commit is contained in:
Mechiel Lukkien 2025-01-30 12:15:44 +01:00
parent ef77f58e08
commit 091faa8048
No known key found for this signature in database
2 changed files with 6 additions and 4 deletions

View File

@ -1866,8 +1866,9 @@ const parseSearchDateTime = (s, isstart) => {
return d ? d.toJSON() : undefined;
}
else if (t.length === 1) {
if (isNaN(Date.parse(fixDate(t[0])))) {
const d = new Date(fixDate(t[0]));
const fds = fixDate(t[0]);
if (!isNaN(Date.parse(fds))) {
const d = new Date(fds);
if (!isstart) {
d.setDate(d.getDate() + 1);
}

View File

@ -486,8 +486,9 @@ const parseSearchDateTime = (s: string, isstart: boolean): string | undefined =>
const d = new Date(fixDate(t[0]) + 'T'+t[1])
return d ? d.toJSON() : undefined
} else if (t.length === 1) {
if (isNaN(Date.parse(fixDate(t[0])))) {
const d = new Date(fixDate(t[0]))
const fds = fixDate(t[0])
if (!isNaN(Date.parse(fds))) {
const d = new Date(fds)
if (!isstart) {
d.setDate(d.getDate()+1)
}