node-imap icon indicating copy to clipboard operation
node-imap copied to clipboard

Search results by SINCE criteria differs when I change the server timezone

Open ays-code opened this issue 4 years ago • 2 comments

Hi. I have been working about three months with this library and I have some issues on results of a search by a SINCE criteria. These results change when I change my server timezone. I don't understand when I put my server timezone GMT >= 0, I get some results that differs when I put GMT < 0.

On the other hand, these results are not exact. It seems some times there is a gap between the since date and the first message date. There are messages that not appear in these results despite it meets the criteria.

Someone can help me with this.

Thank you.

ays-code avatar May 20 '21 01:05 ays-code

The IMAP RFC defines the SINCE criteria like:

Messages whose internal date (disregarding time and timezone) is within or later than the specified date.

imap sends the SINCE value using the Date instance's local date functions.

mscdex avatar May 20 '21 02:05 mscdex

@mscdex I am trying to get unread / unseen emails from the Gmail along with some criteria in since but the email which I have been targeting is missing out and there are other results as well which don't meet the time criteria. I am using - [ ["HEADER", "SUBJECT", "test-string"], ["UNSEEN", ["SINCE", newDate]], ] Here new date is last 2 days - so if today's date is May 16, 2023 it will pas May 14,2023 in searching in string.

Dakshansh avatar May 16 '23 10:05 Dakshansh