google-api-nodejs-client icon indicating copy to clipboard operation
google-api-nodejs-client copied to clipboard

Query mails after date returns results that before this date

Open Aliaksandr-Kasko-JazzTeam opened this issue 1 year ago • 2 comments

Environment details

  • OS: Ubuntu 22.04.2 LTS / Google Cloud Run / Cloud Run Jobs
  • Node.js version: 18.16.1
  • npm version: 9.5.1
  • googleapis version: "@googleapis/gmail": "^3.0.0"

Steps to reproduce

  1. Create a gmail client for some email in your company with domain wide delegation.
  2. List messages with query like {in:inbox in:outbox} after:1689576392 before:1689605192 (after - some stored datetime, before - calculated range in 8 hours)
  3. Returned list contains messages, that have date BEFORE 1689576392.

I believe that this is an issue with time zone. Not sure which time zone this server is, but I think you can handle this issue with adding specific time in the after: query for your time client's zone.

03hgryan avatar Mar 02 '24 07:03 03hgryan

I set time in after stored from last processed message that gmail returns.