-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
parseInputDatesAsUTC in defaults.js #1350
Comments
OK - ignore that :/ - just change the value in pg.defaults - seems a bit crude though. |
Don’t; just store them with a UTC timezone. |
@charmander My DB server was migrated from a MySQL DB where the datetimes were stored as DATETIME, and the migration script created all the columns as time stamps without timezones. This wasn't an issue previously, as all datetimes were implicitly treated as UTC anyway, but now the library is automatically converting every datetime string I pass in from the local timezone to UTC - even though it's passed in as an ISO8601 formatted string that is explicitly stating that it is a UTC timestamp. This is not acceptable behavior, and there needs to be an option to disable it without having to resort to such a clunky workaround. |
@andrewackerman pg doesn’t do anything to strings. Anyway, details in #1746. |
I think the handling of timestamps is still strange. If I'm inserting something with the Btw, I don't ever want to use |
The default However. The Postgres type designed for UTC timestamps is the If you really want to store UTC timestamps in the
This operator also works the other way, converting a
This way node-postgres only have to encode and decode Generally, you are better off storing UTC timestamps in the |
@AlecZadikian9001 You’re right that the handling of |
I see, it makes sense now. So neither timestamp-ish type is storing a timezone. Using |
I'm storing time stamps in my database without a timezone and want to treat all dates in this way, displaying the correct timezone in the UI.
I can parse dates from the database by setting a handler with 'db_types.setTypeParser'
In #943 @spollack submitted a change to add a flag to defaults.js (parseInputDatesAsUTC) to fix this issue #783
While this works, there's no way to actually change this flag from its default (false) except by editing defaults.js in the code. I'd assumed I could over-ride this in my configurations or env but actually that's not possible.
I'm happy to look at addressing this but want to check that I'm not missing something obvious in the code that get me around this.
The text was updated successfully, but these errors were encountered: