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
Fixing problem in date parser #7796
Conversation
The test on NodeV10 is falling cause of "Segmentation fault (core dumped)" |
I don't understand the problem. From my understanding, console.log(new Date('2021-04-28'))
console.log(new Date('2021-04-28').toString())
console.log(new Date('2021-04-28').toISOString()) Output (for me) is: 2021-04-28T00:00:00.000Z
Wed Apr 28 2021 05:00:00 GMT+0500 (Tajikistan Time)
2021-04-28T00:00:00.000Z Now I don't understand what's your problem? There is a timezone inside your data object. Maybe if you provide usage examples I can understand? |
I think it's not true. In your example, you've |
Okay I think I understood the difference. This would be a huge breaking change. We'll need to fix all other related date issues in TypeORM and release it in I'll keep this PR opened for |
* Add referencedSchema to PostgresQueryRunner * Run tests again Co-authored-by: איתמר צבי <211736459@idf.il>
…orm#8507) * fix: add lock clause for MSSQL select with join clause typeorm didn't supported LOCK clause in SELECT + JOIN query. For example, we cannot buld SQL such as "SELECT * FROM USER U WITH(NOLOCK) INNER JOIN ORDER WITH(NOLOCK) O ON U.ID=O.UserID". This pull request enables LOCK with SELECT + JOIN sql query. Closes: typeorm#4764 * chore: add test cases * chore: refactor method name, miscellaneous changes on createTableLockExpression
The following grammatical adjustments are related to the "Avoid relation property initializers" section, found in the relations-faq page; 1. Adjust the grammatical error found in the following phrase "But if you have initializer" by adding "an" before the word "initializer". 2. Adjust the grammatical error found in the following phrase "the loaded object will look like as follow" by removing the "like" word and adding an "s" to "follow".
change the line 46 in relations-faq.md: "Sometimes you want to have in your object id of the related object without loading it. " into this: "Sometimes you want to have, in your object, the id of the related object without loading it. "
…d/remove the DEFAULT value (typeorm#8274) * fix(8273) Adding @generated('uuid') will now generate a migration to add the DEFAULT value * implemented fix for "increment" generation type; implemented fix for generation removal; improved tests; * added test for typeorm#5898 Co-authored-by: AlexMesser
…ypeorm#8618) * fix: upsert should find unique index created by one-to-one relation * fix: do not enforce column constraint exists for upsert * fix: remove OrmUtils reference and OrmUtils#flatten that is not needed * fix: leave the db engine to enforce upsert constraints as it sees fit
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.4 to 1.14.8. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](follow-redirects/follow-redirects@v1.14.4...v1.14.8) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [simple-get](https://github.com/feross/simple-get) from 3.1.0 to 3.1.1. - [Release notes](https://github.com/feross/simple-get/releases) - [Commits](feross/simple-get@v3.1.0...v3.1.1) --- updated-dependencies: - dependency-name: simple-get dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.5 to 2.6.7. - [Release notes](https://github.com/node-fetch/node-fetch/releases) - [Commits](node-fetch/node-fetch@v2.6.5...v2.6.7) --- updated-dependencies: - dependency-name: node-fetch dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* added `uuidjs` lib * package-lock.json
…e PlatformTools method. (typeorm#8595) * chore: remove @types/dotenv * style: improve and reuse PlatformTools logging functions * style: fix eslint errors
* fix: lock peer dependencies versions * package-lock.json
…ypeorm#8403) Closes: typeorm#8398 BREAKING CHANGE: update listeners and subscriber no longer triggered by soft-remove and recover
…typeorm#7349) (typeorm#8185) * feat: add --quiet option to migration:show command * adding process.exit(0) back * Update MigrationShowCommand.ts Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
…typeorm#8447) * fix: QueryFailedError when tree entity with joinColumns (typeorm#8443) * test: add test for typeorm#8443
* test: DeepPartial with generics * fix: resolve DeepPartial generic not matching valid input * fix: resolve TS errors due to DeepPartial change * deep partial type simplification Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
…ite (typeorm#8645) * fix: Allow special keyword as column name for simple-enum type on sqlite * fix: Fix tests * fix: Fix tests
* fix: materialized path being computed as "undefined1." when tree entities are saved implicitly (through another related entity which hasMany tree-entities and "cascade" set to true) the ORM generates materialized-path strings prefixed with "undefined". Resulting in mpaths like "undefined1.2.3" * fix: materialized path being computed as "undefined1." removes it.only * fix: materialized path being computed as "undefined1." fixes unit tests * fix: materialized path being computed as "undefined1." Try to fix unit tests. * fixing failing test * fixing test * fixing test * fixing test * Update materialized-path.ts * Update materialized-path.ts Co-authored-by: Matthias Schwebler <m.schwebler@sportradar.com> Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
…cover with test (typeorm#8445) Closes typeorm#8444 Co-authored-by: Francesco Salvi <francesco.salvi@bitbull.it>
* feat: soft-delete-recursive-cascade * fix get entity primary key * better mapping for get parent ids * fix use identifier and not entity from subject object * remove only from test * fix: replace primary key name to valid name * fix: test bug * fix: change returning to work on mssql * fix: work for oracle * add comments to subject executor Co-authored-by: oxeye-yuvalk <oxeye-yuvalk@oxeye.io>
Due to conflicts manually pushed your changes in 7e625b8 . Will be released in |
* added find options and new option relationLoadStrategy * find now returns null instead of undefined; removed primary relations support; bugfixing; added some changes and tests from next branch; * added typename to connection options; added data loader types, lot of deprecations; new es2020 emit by tsc; new custom repositories syntax * applied lint fixing * replaced some instanceof checks * reverting docker compose image versions * optimizing imports * reverting back some instanceof checks to prevent compiler errors * downgrading es compilation version * docs: remove "primary" from relation options (#8619) remove ex-line 26 for being deprecated in 0.3.0: "* `primary: boolean` - Indicates whether this relation's column will be a primary column or not." * Revert "reverting back some instanceof checks to prevent compiler errors" This reverts commit 7bf12a3. * Revert "optimizing imports" This reverts commit 7588ac1. * Revert "replaced some instanceof checks" This reverts commit bfa5a2d. * fixing few comments * removing transaction decorators * this test is invalid - it's not clear why the hell getTreeRepository will throw an error and it's not clear what kind of error its going to throw * addded mixed list support in connection options * trying to fix oracle length issue * lintfix * removed shorten usages * added named entity target support to the connection * fixing entity target support in relation options via entity schema * debugging oracle issue * fixed issue with alias not being shortened in many to many alias cases * some day we'll have a prettier. * fixing oracle tests * fixing oracle failing test * removed "null" support in where expressions; fixed softDelete and restore incorrect usages * renamed FindConditions to FindOptionsWhere * version bump * docs: update loading relation in find method (v 0.3.0) (#8621) * docs: update relation definition method Update the method that allows loading a specific relation inside the find method. This method is found on the one-to-one-relations page. Change `const users = await userRepository.find({ relations: ["profile"] });` to `const users = await userRepository.find({ relations: {profile: true});`. * fix formatting Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com> * docs: change relations option definition (#8620) * docs: change relations option definition change line 139 from `const users = await connection.getRepository(User).find({ relations: ["profile", "photos", "videos"] });` to `const users = await connection.getRepository(User).find({ relations: { profile: true, photos: true, videos: true] });` to reflect version 0.3.0 changes * docs: change relations option definition Rectified a type on line 139 from: `const users = await connection.getRepository(User).find({ relations: { profile: true, photos: true, videos: true] });` to `const users = await connection.getRepository(User).find({ relations: { profile: true, photos: true, videos: true} });` * formatting Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com> * lint * improved find options types * fixed types and removed nonnever because it causes circual issue for some reason * docs: update entitymanager definition (#8623) * docs: update entitymanager definition change the "What is EntityManager?" page to be up-to-date with v 0.3.0 1. line 6 changes from `You can access the entity manager via 'getManager()' or from 'Connection'.` to `You can access the entity manager via DataSource's manager.` 2. the import on `getManager` in line 10 becomes `Manager` that the user have configured beforehand: `import {getManager} from "typeorm";` becomes `import {Manager} from "./config/DataSource";` 3.change entityManager definition in line 13: from `const entityManager = getManager(); // you can also get it via getConnection().manager` to `const entityManager = Manager;` * docs: update entitymanager definition changed line 10 from: `import {Manager} from "./config/DataSource";` to `import {DataSource} from "typeorm";` and changed line 13 and 14 from: `const entityManager = Manager;` `const user = await entityManager.findOne(User, 1);` to `const myDataSource = new DataSource({ /*...*/ });` `const user = await myDataSource.manager.findOne(User, 1);` for a simpler way of describing the origin of DataSource and how it works. * In return type doesn't seem to work in all cases * feat: mssql v7 support (#8592) Adds support for v7 of the mssql library as v6 is EOL. This also makes use of the new toReadableStream method on requests to return a native stream where required. * fix: prefix relation id columns contained in embedded entities (#6977) (#7432) * fix: prefix relation id columns contained in embedded entities (#6977) Searches embedded entity columns for relation ID column if relation column is in embedded entity. If not found, creates new relation ID with embedded metadata set to match the relation column. fixes: #2254 fixes: #3132 fixes: #3226 fixes: #6977 * test: prefix subcounters sub-entity with "sub" to fit in 30 character identifier for oracle Problem introduced with #6981 * fix: find by Date object in sqlite driver (#7538) * fix: find by Date object in sqlite driver In sqlite, Date objects are persisted as UtcDatetimeString. But a Date object parameter was escaped with .toISOString(), making such queries impossible. This commit aligns both transforms. This bug does *not* apply to better-sql where you can only bind numbers, strings, bigints, buffers, and null. This is breaking for when the user inserted their dates manually as ISO and relied on this old maltransformation, after this their find()s by Date won't work anymore. BREAKING CHANGE: Change Date serialization in selects Closes: #2286 * add failing test * fix: find by Date object in sqlite driver (with query builder) Also consider query builder parameter escaping * test: add test for 3426 Co-authored-by: James Ward <james@notjam.es> * manually ported changes from #7796 * updated changelog * fixes after merge * new findOne syntax * new find* syntax * new find* syntax * lint * tsc version bump * tsc version bump and fixed mongodb issues * moved date fns into non dev deps * returned oracledb dep into place * removed lock files * returned lock files back * eslint upgrade * fixing mongodb issue * fixing mongodb issue * test: keep junction aliases short (#8637) Tests a fix for an issue where junction aliases (e.g. in many-to-many relations) are not unique because they are too long and thus truncated by the driver. Closes: #8627 Related to: 76cee41 * fixing mongodb issues * fixing sqlite test * fixing sqlite test * fixing sqlite test * fixing mongodb test * fixing entity schema tests * fixing entity schema tests * merged latest master * removed driver instanceof checks * removed function instanceof checks * removed Object instanceof checks * removing instanceof checks... * fixing instanceof checks * added InstanceChecker to remove remaining instanceof checks * fixed failing test * linting * fixing failing test * version bump * compiler fixes * Connection type usages replace to DataSource * updated dev deps * updated deps, add prettier, removed oracledb due to m1 issue * chalk downgrade * fixing failing test * applied prettier formatting * replaced eslint to prettier * okay I think we can call it lint * fixing linting * fixed prettier introduced compiler bug * fixed failing test * prettier; * fixed failing test * alias shortening only for junction tables; fixed failing tests; * changed aurora db names and reverted change of junction table name shorten algorithm * format * removed platform from docker compose * made numeric parameters to not use parameters to prevent parameters number limit issue. Also enabled shorten only for junction tables * fixing test * fixing returning columns bugs * fixing test * fixed returning issue * fixing merge conflicts * updating documentation * working on docs / improving api * working on docs * fixed isConnected issue * re-worked commands * commenting cli command tests for now * commenting cli command tests for now * removed platform * returned Connection back * refactor: export tree repository helper methods (#8753) * Migrated protected tree methods to util class * Added tree repository extend override * Ran prettier format * merge master into 0.3.0 Co-authored-by: Bitcollage <serkan.sipahi@yahoo.de> * working on documentation Co-authored-by: Bilel Taktak <47742269+Parsath@users.noreply.github.com> Co-authored-by: Salah Azzouz <52634440+Salah-Azzouz@users.noreply.github.com> Co-authored-by: Daniel Hensby <dhensby@users.noreply.github.com> Co-authored-by: Nebojša Cvetković <nebkat@gmail.com> Co-authored-by: Philip Waritschlager <philip+github@waritschlager.de> Co-authored-by: James Ward <james@notjam.es> Co-authored-by: Felix Gohla <37421906+felix-gohla@users.noreply.github.com> Co-authored-by: Dmitry Zotov <dmzt08@gmail.com> Co-authored-by: Jimmy Chen <50786287+Q16solver@users.noreply.github.com> Co-authored-by: Bitcollage <serkan.sipahi@yahoo.de>
Description of change
new Date(ISOString) is not a reliable parser to date strings.
It's better to use 'date-fns' parser to parser string in ISO Format.
The problem here is with wrong timezone.
For example:
new Date('2021-04-28')
will generate2021-04-28T00:00:00.000Z
in my timezone, which is not true for my timezone (GMT-0300). It should
be
2021-04-28T03:00:00.000Z
asnew Date(2021, 3, 28)
generates.https://stackoverflow.com/a/2587398
origin from #7600
Pull-Request Checklist
master
branchnpm run lint
passes with this changenpm run test
passes with this changeFixes #0000