Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequelize 4 returns date strings not timestamps so don't shift #123

Closed
wants to merge 1 commit into from

Conversation

gcoombe
Copy link

@gcoombe gcoombe commented Nov 10, 2017

As of Sequelize 4 dateonly fields are returned as date strings not
dateTime strings. Therefore the formatting functionality here will
return incorrect values for dateonly fields in Sequelize 4 if the server
is in a timezone with a negative UTC shift.

Ex: I have 1990-10-02 stored in my DB. The formatting function will
shift that to 1990-10-01T16:00:00 if I am in PST. In the UI 01/10/1990
will be shown

sequelize/sequelize#4858

As a sidenote the existing shifting logic seems backwards to me but it's very possible that I'm missing something. Let's say I have a DATEONLY value of 1990-10-02 in my db. My understanding of sequelize 3 is that it will return 1990-10-02T00:00:00z. If I have a negative UTC offset it's still going to shift my date back to the wrong day. I didn't make a change here as I figure I might be missing something.

Accompanying change coming in https://github.com/forestadmin/forest-express-sequelize

As of Sequelize 4 dateonly fields are returned as date strings not
dateTime strings.  Therefore the formatting functionality here will
return incorrect values for dateonly fields in Sequelize 4 if the server
is in a timezeon with a negative UTC shift.

Ex: I have 1990-10-02 stored in my DB.  The formatting function will
shift that to 1990-10-01T16:00:00 if I am in PST.  In the UI 01/10/1990
will be shown

sequelize/sequelize#4858
@arnaudbesnier
Copy link
Member

Fixed here: #175

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants