I am working with an app with this conditions:
- Client is in different countries. (Local time zone will vary)
- I do not now exactly which time-zone will server located at.
Example:
In MongoDB using mongoose time stamp functionality :
createdAt: 2024-09-02T22:44:26.794+00:00 //Local time in client: 2024-09-02T16:44:26.794-06:00
Now the issue I am facing is:
“I want to retrieve all the documents created “TODAY” , but the meaning off today is relative to “local time” where the query was used, example:
Day starts in GTM-6 at 2024-09-02T06:00:00.000+00:00
Day starts in GTM-1 at 2024-09-02T01:00:00.000+00:00
So I need the “best practice” to work with dates on javascript.
¿How to tell the query that it needs to use a specific offset?