Comments (3)
Thanks! Pulled. If I understand correctly, without this, Postgres interprets timestamp as being local time, even though it is UTC (since toISOString gives a UTC time). With patch, postgres interprets it as UTC.
from connect-session-knex.
Yes, at least from what I understood, but I am by no means a postgres expert.
Thanks!
Michael
from connect-session-knex.
Hi, I believe this is not properly fixed yet, at least in my case it doesn't work (v1.0.19)
When saving the 'expired' time stamp in the "set" method:
- new Date(expired).toISOString() returns a timestamp in UTC
- knex sends that timestamp to postgresql, and because the column "expired" in Postgres has no tz information, the tz is simply ignored and the timestamp is interpreted and saved as local time (CET in my case).
I discovered this because I set my session cookie to expire in 1 hour with my machine being running in CET, which currently is one hour ahead of UTC. The effect was that all my sessions instantly expired.
I believe the proper fix is to set the 'expired' column for postgresql to "timestamp with time zone" by removing the "true" parameter on line 101 (version 1.0.19). Only then postgresql will consider the time zone information in the ISO string.
from connect-session-knex.
Related Issues (20)
- Feature Request: Add options to specify column names of sessions table
- Support knex v3 HOT 4
- saving session info in the postgres DB
- broken with [email protected] since it no longer includes Bluebird HOT 12
- [docs] Create a Changelog.md File HOT 1
- UnhandledPromiseRejectionWarning when used with knex with mysql2 driver and MySQL 5.7 HOT 3
- Connect-session-knex does not work with older versions of mysql HOT 1
- MySQL multiple ER_PARSE_ERROR HOT 1
- Unhandled rejection in dbCleanup HOT 3
- Configurable Callback for Destroy function
- default sqlite3 being used instead of mysql table sessions, option issue? HOT 2
- Add example Knex Migration to docs HOT 3
- TypeError: self.knex.schema.hasTable is not function
- Add cockroach support
- MSSQL Schema Equivalents - Clustered/Non-Clustered?
- incompitable types: 'generateDdlCommands' is missing in type Raw<any> but required in Knex.Raw<any> HOT 1
- Publish update to npm HOT 1
- Add custom fields as a column HOT 1
- Cannot use v2.1.1 in TypeScript HOT 7
- Knex v2.0.0? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from connect-session-knex.