Skip to content

Revisions show incorrect date #919

Description

@LeanderG

Description

Image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingroadmap/1.0Issues included in the public EmDash 1.0 roadmap.roadmap/editorial-safetyRoadmap track: editorial safety and publishing workflow.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions