Skip to content

Dates are fetched with wrong timezone #8708

Open

Description

@Natanael1234

The database and node are set as -02:00 timezone.

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.

Activity

  1. minhqp commented on Dec 3, 2017

    @minhqp

    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.

  2. dogancan-yigit commented on Dec 11, 2017

    @dogancan-yigit

    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.

  3. JuliaRakitina commented on Mar 2, 2018

    @JuliaRakitina

    Same issue, it somehow adds two hour to answer

  4. Gpia commented on Mar 14, 2018

    @Gpia

    i have the problem too

  5. added and removed on Jun 12, 2018
  6. amanchopra95 commented on Sep 13, 2018

    @amanchopra95

    This issue still persists. Only solution I can think off is to manually add the date and not to use timezone.

  7. added and removed on Dec 12, 2018
  8. zqian7531 commented on May 9, 2019

    @zqian7531
  9. deleted a comment from stale on Aug 17, 2019
  10. deleted a comment from stale on Aug 17, 2019
  11. deleted a comment from stale on Aug 17, 2019
  12. changed the title [-]Sequelize returning dates with wrong time Ask Question[/-] [+]Dates are fetched with wrong timezone[/+] on Aug 17, 2019
  13. added
    type: bug
    on Aug 17, 2019
  14. added
    topic: dates & times
    on Oct 30, 2019
  15. krajicj commented on Feb 6, 2020

    @krajicj

    Same problem here

  16. igolskyi commented on Dec 7, 2021

    @igolskyi

    My answer on StackOverflow for Sequelize and Postgres, but possible it can be helpful here.

  17. JesusGMM commented on Jul 3, 2024

    @JesusGMM

    there is progress on this issue

  18. added theissue type on Mar 9, 2025
  19. removed
    type: bug
    on Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: dates & times

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions