Giter Site home page Giter Site logo

Comments (3)

gx0r avatar gx0r commented on June 14, 2024

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.

micheee avatar micheee commented on June 14, 2024

Yes, at least from what I understood, but I am by no means a postgres expert.
Thanks!
Michael

from connect-session-knex.

sboehler avatar sboehler commented on June 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.