contember / contember

Contember is an open source platform that empowers developers to quickly build and manage data-driven web applications with TypeScript and React.
https://www.contember.com
Other
165 stars 16 forks source link

Contember looses precision in datetime column #613

Closed VojtaStanek closed 3 weeks ago

VojtaStanek commented 3 weeks ago

When a column is set using now it saves microsecond precision timestamp, then when I retrieve such a value using Contember it is rounded to millisecond. It can cause a bug when I copy this value to another column I would expect to them to be equal, which they will not.

PostgreSQL uses 1 microsecond precision in timestampz column (source). Javascript uses millisecond precision(source).

The use-case for me was that had a updatedAt datetime column and a lastSynced datetime column and a view that checks if updatedAt > lastSynced that I should sync. After the sync operation I set updatedAt to lastSynced value... But that doesn't work - if updatedAt is 2024-10-11 09:46:06.309921+00, I can set lastSynced to 2024-10-11 09:46:06.309000+00 - and that's smaller value.

ViliamKopecky commented 3 weeks ago

😉 https://github.com/contember/contember/pull/601