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
@PavelPolyakov The output you provided doesn't actually show that the dates are wrong. You are likely logging a javascript date object which will usually display in your local time zone.
You can verify it's indeed working by looking at the raw data instead.
What's the raw value in postgres? If it's Sat May 16 2015 06:00:46 then it's correct, if not there's a bug.
@PavelPolyakov You are logging javascript date objects, so you can't expect them to have 00:00 as timezone (they'll use your local timezone), but they should work fine with UTC values, converting them internally.
Technically, sequelize does not, node pg does - since it automatically converts the string from the db to a date object, assuming that the date is in the current timezone of the server. This is an implementation detail of javascript.
There is another issue relating to this with a fix included. I'll try to find it in a bit
I believe I had a discussion with someone about integrating this code into sequelize. There was a reason not to do it, but I can find the issue or remember the reasoning right now :)
Activity
mickhansen commentedon May 20, 2015
@PavelPolyakov The output you provided doesn't actually show that the dates are wrong. You are likely logging a javascript date object which will usually display in your local time zone.
You can verify it's indeed working by looking at the raw data instead.
PavloPoliakov commentedon May 20, 2015
@mickhansen
In the postgreSQL the data stored like timestamp
What I log is:
Is something wrong with my approach ?
mickhansen commentedon May 20, 2015
What's the raw value in postgres? If it's
Sat May 16 2015 06:00:46then it's correct, if not there's a bug.@PavelPolyakov You are logging javascript date objects, so you can't expect them to have 00:00 as timezone (they'll use your local timezone), but they should work fine with UTC values, converting them internally.
PavloPoliakov commentedon May 20, 2015
@mickhansen

Here are the database values:
mickhansen commentedon May 20, 2015
Then it does appear to be a bug.
You'll have to share your configuration etc, maybe @janmeier can help.
PavloPoliakov commentedon May 20, 2015
My sequelize connection looks the next way:
That's the table DDL:
@janmeier
Please, advice either how should I doublecheck if the timezone is working or - which information I can provide you in addition.
janmeier commentedon May 20, 2015
Sequelize expects timestamp with timezone in postgres
On May 20, 2015 4:42 PM, "Pavel" [email protected] wrote:
PavloPoliakov commentedon May 20, 2015
@janmeier
So, if there is a timestamp without the timezone, then sequelize would put the current node timezone?
Could we do something about it? Together with hapijs issue ( hapijs/hapi#2542 ) it makes a time shift, which we doesn't expect to have :)
Any advice?
janmeier commentedon May 20, 2015
Technically, sequelize does not, node pg does - since it automatically converts the string from the db to a date object, assuming that the date is in the current timezone of the server. This is an implementation detail of javascript.
There is another issue relating to this with a fix included. I'll try to find it in a bit
PavloPoliakov commentedon May 20, 2015
@janmeier
Thanks, looking forward for the link.
janmeier commentedon May 20, 2015
http://docs.sequelizejs.com/en/latest/docs/models-definition/#data-types looks for the
setTypeParserpartI believe I had a discussion with someone about integrating this code into sequelize. There was a reason not to do it, but I can find the issue or remember the reasoning right now :)
PavloPoliakov commentedon May 20, 2015
@janmeier
Thanks!
PavloPoliakov commentedon May 24, 2015
btw,
how we've solved it:
The one from the link was not working.
janmeier commentedon May 24, 2015
But won't that return a string and not a date object?