MongoDB database gives me the wrong time from input with type datetime-local

345 views Asked by At

When I write a date in my input I receive the wrong time in the database (2 hours earlier than the time I want), in the pictures you can see that I got the hour 5:21 in the database even though I wrote the time 7:21 in the input:

The time in the input: the time in the input

The time in the database:

the time in the database

I thought that it is maybe because of the time zone (I am In Israel) and I try to use the Library Moment.

In this way:

holiday.beginDate = moment.tz(req.body.beginDate, "Asia/Jerusalem");

But, I get the same result.

Someone can tell me what I am doing wrong or what should I do to make the time I write in the input be the same time in the database?

Thank you.

0

There are 0 answers