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
Describe the bug
This is basically a duplicate of typeorm/typeorm#9627. It's mainly here to track the timestamp issue within Vendure as well.
In TypeORM columns with timestamp or timestamp without time zone type is read as local date, not UTC.
This happens with automatically created values as well (e.g., @CreateDateColumn()). In Vendure, the base VendureEntity applies the default @CreateDateColumn() to createdAt and @UpdateDateColumn() to updatedAt, causing them to persist with incorrect timestamps.
To Reproduce
Follow the "To Reproduce" section in this issue: TypeORM Issue #9627
Expected behavior
Entities extending the base VendureEntity should have the correct createdAt and updatedAt timestamps
Environment (please complete the following information):
Suggested solution
Use the timestamptz type which is an abbreviation for type timestamp with time zone. It should internally store them in UTC, but converted to the session's time zone when queried.
Describe the bug
This is basically a duplicate of typeorm/typeorm#9627. It's mainly here to track the timestamp issue within Vendure as well.
In TypeORM columns with
timestamp
ortimestamp without time zone
type is read as local date, not UTC.This happens with automatically created values as well (e.g.,
@CreateDateColumn()
). In Vendure, the baseVendureEntity
applies the default@CreateDateColumn()
tocreatedAt
and@UpdateDateColumn()
toupdatedAt
, causing them to persist with incorrect timestamps.To Reproduce
Follow the "To Reproduce" section in this issue: TypeORM Issue #9627
Expected behavior
Entities extending the base VendureEntity should have the correct
createdAt
andupdatedAt
timestampsEnvironment (please complete the following information):
Related issues
typeorm/typeorm#9627
typeorm/typeorm#2220
typeorm/typeorm#8296
typeorm/typeorm#5841
typeorm/typeorm#7184
#1375
Suggested solution
Use the
timestamptz
type which is an abbreviation for typetimestamp with time zone
. It should internally store them in UTC, but converted to the session's time zone when queried.An alternative is to configure the driver to interpret timestamps as UTC inside your project
The text was updated successfully, but these errors were encountered: