-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
ISO DateTime parsing returning wrong Date value #9941
Comments
Thanks @jclx ! I got an offset of 1 hour. Moving back to 0.3.12 the end to end tests working fine. |
Thanks for reporting this! |
As it seems, changing |
We can't use 0.3.12 because of windows path bug which is fixed in 0.3.13 but now the timestamp issue. |
We have same issue too. in my case, typeorm timezone config: 'Z' if service locale change test case is success request save entity time: "2023-01-01T14:00:00.000Z" |
This ticket got no attention? |
Please check the CHANGELOG for the affected version, and ping the author of the changes. If you'll create a PR with a clear reproduction of the problem, I'll take a look on it. |
Here is an example transformer as a workaround that seems to work for me:
What do you think? |
I'm with the same problem. When recording Datetime type field data in Mysql, it does not respect the correct time. In version 0.3.12 it works correctly. |
Hey @pleerock Thank! Hope that helps. |
Same problem here with MySQL using 0.3.15, downgrading to 0.3.12 fixes the issue. |
I have also downgraded to 0.3.12 due to this issue. |
Add a test for date handling functions that seem to ignore the timezone offsets on insert. Related to typeorm#9941 Introduced in typeorm#9634
The issue is that there's a difference between how dates (only) and date-times are parsed in ECMA-script. The newly introduced parser (which does not use @pleerock I created #10011 for a fix. Maybe there's some potential for discussion, however. |
Add a test for date handling functions that seem to ignore the timezone offsets on insert. Related to typeorm#9941 Introduced in typeorm#9634
Add handling for the different timezones during parsing ISO dates as there's a difference in date parsing and date-times parsing in the ECMA-script specs. Fix the bit where even dates with given timezones were parsed as local time. Related To typeorm#9941
Add handling for the different timezones during parsing ISO dates as there's a difference in date parsing and date-times parsing in the ECMA-script specs. Fix the bit where even dates with given timezones were parsed as local time. Related To typeorm#9941
Add handling for the different timezones during parsing ISO dates as there's a difference in date parsing and date-times parsing in the ECMA-script specs. Fix the bit where even dates with given timezones were parsed as local time. Related To typeorm#9941
Add a test for date handling functions that seem to ignore the timezone offsets on insert. Related to typeorm#9941 Introduced in typeorm#9634
Add handling for the different timezones during parsing ISO dates as there's a difference in date parsing and date-times parsing in the ECMA-script specs. Fix the bit where even dates with given timezones were parsed as local time. Related To typeorm#9941
I have now the same issue and also had to downgrade to 0.3.12 I have my local Timezone configured as "Europe/Madrid" (GMT+2) If I save the value "2023-05-07 14:50:45.768", the real value saved on database is "2023-05-07 12:50:45.767000" and when queried return the value "2023-05-07T10:50:45.770Z" what is wrong. However, If I save the value "2023-05-07 14:53:13.150Z", the real value saved on database is "2023-05-07 14:53:13.166000" and when queried return the value "2023-05-07T12:53:13.164Z", so it's correct, but on previous versions I did not have to send that "Z" in the end. My schema is that: |
Okay, as it always with dates - things are complicated. I had to revert the previous changes, because it's the most safe solution at the moment. Meanwhile, we need to analyze all the issues with dates, and came up with some solution most compliant with widely / future adopted standards. Thanks for the investigation @felix-gohla |
@pleerock It is still happening in 0.3.17 |
Any update on this issue ? It seems to be still happening for me too in 0.3.17... |
In recent release it looks like Date-FNS package was removed and TypeOrm is doing it's own parsing but the calculation for calculation is problematic.
In src/util/DateUtils.ts this method was added to replace date-fns.parseISO
However the above code returns the datetime with wrong values.
Example:
Given this string: '2023-04-11T16:56:57.572Z'
The above function returns: '2023-04-11T23:56:57.572Z' depending on what timezone your environment is configured for, this example it is -07:00.
Where as date-fns.parseISO() returns: '2023-04-11T16:56:57.572Z' which seems correct.
The text was updated successfully, but these errors were encountered: