You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I save a register, using sequelize, it saves the register with the right date and time in its date fields. For example, if I save a register with the field moment set as '2017-01-15T23:59:59-0200' and look in the database via MySQL Workbench I will see 2017-01-16 00:00:00 in the respective column.
I can even correctly find registers and filter by date and time.
But the value returned by a find operation in the field is '2017-01-16T01:59:59.000Z', meaning it was added two hours to the answer.
Reacted by Doğancan Yiğit, JotaFerreira and Ravid Ashurov
I'm also facing with this issue. I set timezone to +07:00 in config.json and datetime is saved exactly like I expected in MySQL database. But when I made queries, it shows datetime without timezone with format is different in real database.
Found an old question on StackOverflow about the exact same issue.
Even with DATEONLY field, this error occurs: stored correctly, returned date minus 1 day.
Had to change the timezone in config.json to 00:00 to fix it temporarily.
Activity
minhqp commentedon Dec 3, 2017
I'm also facing with this issue. I set timezone to +07:00 in
config.jsonand datetime is saved exactly like I expected in MySQL database. But when I made queries, it shows datetime without timezone with format is different in real database.dogancan-yigit commentedon Dec 11, 2017
Found an old question on StackOverflow about the exact same issue.
Even with
DATEONLYfield, this error occurs: stored correctly, returned date minus 1 day.Had to change the timezone in
config.jsonto 00:00 to fix it temporarily.JuliaRakitina commentedon Mar 2, 2018
Same issue, it somehow adds two hour to answer
Gpia commentedon Mar 14, 2018
i have the problem too
amanchopra95 commentedon Sep 13, 2018
This issue still persists. Only solution I can think off is to manually add the date and not to use timezone.
zqian7531 commentedon May 9, 2019
Natanael's answer solved my problem: https://stackoverflow.com/a/47554578/5742887
[-]Sequelize returning dates with wrong time Ask Question[/-][+]Dates are fetched with wrong timezone[/+]krajicj commentedon Feb 6, 2020
Same problem here
igolskyi commentedon Dec 7, 2021
My answer on StackOverflow for Sequelize and Postgres, but possible it can be helpful here.
JesusGMM commentedon Jul 3, 2024
there is progress on this issue