Hi Im trying to save time and date to Mongo DB but it seems to be changing the date to another format and even when I try in that format it removes the timezone and changes the time
2022-03-30T09:00:46-07:00
becomes
2022-03-30T16:00:46.000+00:00
*My issue is when I send emails to tell clients the time it sends the wrong time completely causing confusion.
How can I ensure the timezone get saved in Mongo.
Im using graphql as an api lang if needed.
2
Answers
There was no way to do it. It's best to store timezone separate and convert
sender:
new Date().toISOString()
Receiver:
idea: parse iso string to iso date
package: date-fns
method: parseISO(inputISOString)