Skip to content

Commit 091faa8

Browse files
committed
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.
1 parent ef77f58 commit 091faa8

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

webmail/webmail.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,8 +1866,9 @@ const parseSearchDateTime = (s, isstart) => {
18661866
return d ? d.toJSON() : undefined;
18671867
}
18681868
else if (t.length === 1) {
1869-
if (isNaN(Date.parse(fixDate(t[0])))) {
1870-
const d = new Date(fixDate(t[0]));
1869+
const fds = fixDate(t[0]);
1870+
if (!isNaN(Date.parse(fds))) {
1871+
const d = new Date(fds);
18711872
if (!isstart) {
18721873
d.setDate(d.getDate() + 1);
18731874
}

webmail/webmail.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,9 @@ const parseSearchDateTime = (s: string, isstart: boolean): string | undefined =>
486486
const d = new Date(fixDate(t[0]) + 'T'+t[1])
487487
return d ? d.toJSON() : undefined
488488
} else if (t.length === 1) {
489-
if (isNaN(Date.parse(fixDate(t[0])))) {
490-
const d = new Date(fixDate(t[0]))
489+
const fds = fixDate(t[0])
490+
if (!isNaN(Date.parse(fds))) {
491+
const d = new Date(fds)
491492
if (!isstart) {
492493
d.setDate(d.getDate()+1)
493494
}

0 commit comments

Comments
 (0)