You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Search on:/before:/after: shifted by the timezone offset #42592
The date filters in message search return the wrong day for anyone not in the server's timezone.
To reproduce: on a server running in UTC, set your browser to Tokyo (UTC+9), send a message at 10am, then search on:<today>. It isn't found, because the search window actually starts at 6pm local time.
The offset math in parseMessageSearchQuery.ts has both signs flipped (+ getTimezoneOffset()/60 + utcOffset), so the day ends up shifted by about twice the user's offset. It only works when the server and the user share a timezone, which is probably why it hasn't come up in local dev. Something like Date.UTC(y, m - 1, d) - utcOffset * 3600000 should fix it. Happy to send a PR.
Hi, I'd like to work on this. The before:/after:/on: handlers in parseMessageSearchQuery.ts add both offsets instead of subtracting them, so I'd build the day start from Date.UTC minus the user's utcOffset, and add spec cases for positive and negative offsets.
Activity
schizophrenicmaniac commentedon Oct 6, 2026
Hi, I'd like to work on this. The before:/after:/on: handlers in parseMessageSearchQuery.ts add both offsets instead of subtracting them, so I'd build the day start from Date.UTC minus the user's utcOffset, and add spec cases for positive and negative offsets.
mandar1045 commentedon Oct 6, 2026
@schizophrenicmaniac thanks for it , but im already working on this issue .
goransh-walia commentedon Oct 7, 2026
This is a known pattern that's worth having documented clearly in the issue tracker.