Description
It always showed "2 hours ago" even though I created them a second ago. After the fix it show "just now" correctly.
In dialect-helpers.ts the current time is created with this code:
export function currentTimestamp(db: Kysely<any>): RawBuilder<string> {
if (isPostgres(db)) {
return sql`CURRENT_TIMESTAMP`;
}
return sql`(datetime('now'))`;
}
(same with the function currentTimestampValue)
My suggestion would be to change it to:
export function currentTimestamp(db: Kysely<any>): RawBuilder<string> {
if (isPostgres(db)) {
return sql`CURRENT_TIMESTAMP`;
}
return sql`(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))`;
}
This would avoid bugs when parsing these Dates in JS.
new Date('2026-05-03 17:26:23') is parsed incorrectly while new Date('2026-05-03T17:26:23Z') is parsed correctly.
I'm not sure if a migration would need to be created for this change.
Steps to reproduce
Make a change to a post and then open revisions with a database other than postgres.
Environment
- emdash 0.9.0
- database other than postgres
Logs / error output
Description
It always showed "2 hours ago" even though I created them a second ago. After the fix it show "just now" correctly.
In
dialect-helpers.tsthe current time is created with this code:(same with the function
currentTimestampValue)My suggestion would be to change it to:
This would avoid bugs when parsing these Dates in JS.
new Date('2026-05-03 17:26:23')is parsed incorrectly whilenew Date('2026-05-03T17:26:23Z')is parsed correctly.I'm not sure if a migration would need to be created for this change.
Steps to reproduce
Make a change to a post and then open revisions with a database other than postgres.
Environment
Logs / error output