skip to Main Content

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


  1. Chosen as BEST ANSWER

    There was no way to do it. It's best to store timezone separate and convert


  2. sender:

    new Date().toISOString()

    1

    Receiver:

    idea: parse iso string to iso date

    package: date-fns

    method: parseISO(inputISOString)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search