-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Do not assume dates with no timezone specifier are UTC #226
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
Conversation
a possible improvement would be to enhance parseDate to take an additional argument (hasTimezone) that could default to true for backward compatibility and only set to off while parsing values of type oid 1114 |
Hey thanks! Working with timezones is a pain. Working with timezones in JavaScript is even worse. I appreciate this. Maybe we could do 2 things real quick before I merge.
|
My scenario is I have a "timestamp with no timezone" field in postgresql I needed this patch because the value extracted wasn't the same as the I think the PostgreSQL manual says that "timestamp with no timezone" So since the writer and the reader (in my case) are on the same timezone About testing, I think you can set a TZ env variable to something and verify |
Thanks for the explanation. I'm totally on board for changing this. I'll get the tests passing (I'm not in GMT either) and then merge it this weekend. |
Any luck with those tests ?
fixes the test for dateParser (query-tests.js line 6) --strk; |
Sorry it took longer than I thought to get around to it. I'm going to get On Mon, Dec 10, 2012 at 8:10 AM, strk notifications@github.com wrote:
|
merged! Bumped minor version up since it changes the way dates come back. |
thanks so much for the pull req! 🎉 |
Ok.. so wtf.. "2012-10-10T10:30:00+03:00" goes to database as "2012-10-10-07:30:00" and comes out as "2012-10-10-07:30:00+03:00" IMO this is a regression.. |
So this means: var date = new Date();
console.log(date);
pg.query("INSERT INTO foo (timestamp_column) VALUES ($1)", [date], function(err, results) {
pg.query("SELECT * FROM foo", function(err, results) {
console.log(results.rows[0].timestamp_column);
});
}); Produces:
|
How does [date] expand to ? |
@nnarhinen could you give a full file (minus connection string) I could execute and see the problem? If you're using |
Fixes #225