You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As an example, if the date stored in the database is 0202-01-01 which is a valid date, the output from parsing will be 202-01-01. This format breaks validation when returning a response if validation requires a valid ISO date format
Expected Behavior
A date from year 1 to year 999 should contain a leading 0 when parsed from the database
Actual Behavior
The leading 0 is being stripped from the date
Additional Context
Relevant Database Driver(s)
DB Type
Reproducible
aurora-mysql
no
aurora-postgres
no
better-sqlite3
no
cockroachdb
no
cordova
no
expo
no
mongodb
no
mysql
no
nativescript
no
oracle
no
postgres
yes
react-native
no
sap
no
spanner
no
sqlite
no
sqlite-abstract
no
sqljs
no
sqlserver
no
Are you willing to resolve this issue by submitting a Pull Request?
✅ Yes, I have the time, and I know how to start.
✖️ Yes, I have the time, but I don't know how to start. I would need guidance.
✖️ No, I don’t have the time, but I can support (using donations) development.
✖️ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
The text was updated successfully, but these errors were encountered:
…rm#9236)
* fix: update date utils to parse year correctly for years 1-999
Closes: typeorm#9230
* fix: commit change to date utils
* fix: default total length to 2
nordinh
pushed a commit
to nordinh/typeorm
that referenced
this issue
Aug 29, 2022
…rm#9236)
* fix: update date utils to parse year correctly for years 1-999
Closes: typeorm#9230
* fix: commit change to date utils
* fix: default total length to 2
Issue Description
There is an edge case with very early years where the date parsing logic is incorrect. The code here does not handle years 1-999 correctly: https://github.com/typeorm/typeorm/blob/51b2a63d/src/util/DateUtils.ts#L25
As an example, if the date stored in the database is
0202-01-01
which is a valid date, the output from parsing will be202-01-01
. This format breaks validation when returning a response if validation requires a valid ISO date formatExpected Behavior
A date from year 1 to year 999 should contain a leading 0 when parsed from the database
Actual Behavior
The leading 0 is being stripped from the date
Additional Context
Relevant Database Driver(s)
aurora-mysql
aurora-postgres
better-sqlite3
cockroachdb
cordova
expo
mongodb
mysql
nativescript
oracle
postgres
react-native
sap
spanner
sqlite
sqlite-abstract
sqljs
sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
The text was updated successfully, but these errors were encountered: