-
Notifications
You must be signed in to change notification settings - Fork 161
Parsing Date
from database to Js Date
result in an off date by one day (debanding on local time)!
#1451
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
Comments
Date
from database to Js Date
result in an off date by one day!Date
from database to Js Date
result in an off date by one day (debanding on local time)!
A few things:
Would you be able to send a PR? |
@mcollina I can make a PR for this. Please note that as mentioned by @abdelrazzaq-dev, We can default the |
Take a look at this: platformatic/packages/sql-mapper/test/helper.js Lines 3 to 5 in 690d165
|
@mcollina thank you for pointing me to that. It fixes the issue. However, this only works when So, please let me know if I should make it configurable or just default it to UTC? |
don't you think this should be fixed @databases/sql? and make the TZ also
configurable for pg?
…On Tue, Sep 12, 2023 at 4:19 PM AbhilakshSinghReen ***@***.***> wrote:
@mcollina <https://github.com/mcollina> thank you for pointing me to
that. It fixes the issue.
However, this only works when process.env.TZ is set to UTC. The bug still
occurs even if we set both the database's timezone and the platformatic
application's timezone to the same value which is not UTC.
For example, setting the database timezone to +05:30 in PgAdmin and also
setting process.env.TZ to the corresponding value of Asia/Kolkata still
creates the issue.
So, please let me know if I should make it configurable or just default it
to UTC?
—
Reply to this email directly, view it on GitHub
<#1451 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFRS4BZYZH2GUUATODC6VW3X2BVQNANCNFSM6AAAAAA4FAOBUA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@abdelrazzaq-dev you're right, I've created an issue on the The way the However, there is a workaround that is already being used in But still, I agree, that the issue is from |
Uh oh!
There was an error while loading. Please reload this page.
The bug is when we parse a
date
from a Postgres column like2023-06-01
the result date in javascript will be something like2003-04-30T22:00:00.000Z
, now we are in a different month.I investigated the issue a little and it's related to
@databases/db
, theConnectionPoolConfig
has atimeZone
property and I think it defaults tolocal
so the date gets parsed thinking it's a local date, though the data it's a copy from the real data and it's in UTC format.I think we need to add the
timeZone
property to PlatformaticDB config file!Issue reproduction https://github.com/abdelrazzaq-dev/date-parse-bug
After a second verification, I only see the
timeZone
in MySql!The text was updated successfully, but these errors were encountered: