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
Package versions and database engine type (please complete the following information):
Database Engine: postgres
TypeORM Version: 0.3.7
Driver Version: 2.4.2
Describe the bug
When creating an Entity using CreateDateColumn, UpdateDateColumn or DeleteDateColumn a TypeError: date.getUTCFullYear is not a function
and try to save an entry dataSource.getRepository(Entity).save(entity);
Possible Solution
Saving throws the following error TypeError: date.getUTCFullYear is not a function in typeorm-aurora-data-api-driver/dist/typeorm-aurora-data-api-driver.umd.js:962:25 which is called in ypeorm-aurora-data-api-driver/dist/typeorm-aurora-data-api-driver.umd.js:1235:32.
It seems like you're calling dateToDateTimeString on a string when expecting a date:
case 'timestamp':
case 'datetime':
case 'timestamp with time zone':
case 'timestamptz':
return {
value: dateToDateTimeString(value),
cast: 'TIMESTAMP',
};
changing this segment to
case 'timestamp':
case 'datetime':
case 'timestamp with time zone':
case 'timestamptz':
return {
value: dateToDateTimeString(new Date(value)),
cast: 'TIMESTAMP',
};
resolves the issue for me.
I can't tell if this has any unexpected consequences for other functionalities but as of now this seems to be working just fine. I'll fork for now but am happy to create a PR in case you approve this solution. Also I'm very open if someone can suggest a better approach.
The text was updated successfully, but these errors were encountered:
Package versions and database engine type (please complete the following information):
Describe the bug
When creating an Entity using CreateDateColumn, UpdateDateColumn or DeleteDateColumn a
TypeError: date.getUTCFullYear is not a function
To Reproduce
Create an Entity like this
and try to save an entry
dataSource.getRepository(Entity).save(entity);
Possible Solution
Saving throws the following error
TypeError: date.getUTCFullYear is not a function
intypeorm-aurora-data-api-driver/dist/typeorm-aurora-data-api-driver.umd.js:962:25
which is called inypeorm-aurora-data-api-driver/dist/typeorm-aurora-data-api-driver.umd.js:1235:32
.It seems like you're calling dateToDateTimeString on a string when expecting a date:
changing this segment to
resolves the issue for me.
I can't tell if this has any unexpected consequences for other functionalities but as of now this seems to be working just fine. I'll fork for now but am happy to create a PR in case you approve this solution. Also I'm very open if someone can suggest a better approach.
The text was updated successfully, but these errors were encountered: