Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with IMAP SINCE ’Search‘ Timezone Handling #919

Open
Wanglintc opened this issue Aug 6, 2024 · 1 comment
Open

Issue with IMAP SINCE ’Search‘ Timezone Handling #919

Wanglintc opened this issue Aug 6, 2024 · 1 comment

Comments

@Wanglintc
Copy link

Description:
I am using the node-imap package in my Node.js application, and my email server is hosted on Alibaba Cloud in China. My Node.js server is also located in China, operating in the China Standard Time (CST) timezone, which is UTC+8.

Here's my issue: when I perform an IMAP search using the SINCE condition with a date string like '2024-08-05', it seems like the IMAP server interprets this date as '2024-08-04 16:00:00' UTC due to the timezone difference. This results in missing emails that arrived between 2024-08-05 00:00:00 CST and 2024-08-05 08:00:00 CST.

Questions:

  1. How can I ensure that the SINCE condition in the IMAP search takes into account the local timezone (CST) and does not miss any emails?
  2. Is there a recommended approach to handle this timezone difference when performing IMAP searches with the SINCE condition?
  3. Are there any best practices for ensuring consistent time handling between the client and server when both are in different timezones?

Any help or guidance on this issue would be greatly appreciated. Thank you!

@mscdex
Copy link
Owner

mscdex commented Aug 6, 2024

Probably the easiest method is to convert between timezones using Intl.DateTimeFormat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants