Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(ui): parse naive server timestamps as UTC for palette image titles
joshistoast0c08a128eab2
diff --git a/invokeai/frontend/webv2/src/platform/time/serverTimestamp.test.ts b/invokeai/frontend/webv2/src/platform/time/serverTimestamp.test.tsnew file mode 100644index 0000000000..c010b06dcf--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/time/serverTimestamp.test.ts@@ -0,0 +1,18 @@+import { describe, expect, it } from 'vitest';++import { normalizeServerTimestamp } from './serverTimestamp';++describe('normalizeServerTimestamp', () => {+ it('parses naive SQLite timestamps as UTC', () => {+ expect(normalizeServerTimestamp('2026-06-11 09:21:04.123')).toBe('2026-06-11T09:21:04.123Z');+ });++ it('passes ISO timestamps through unchanged', () => {+ expect(normalizeServerTimestamp('2026-06-11T09:21:04.123Z')).toBe('2026-06-11T09:21:04.123Z');+ });++ it('passes unparseable values through unchanged', () => {+ expect(normalizeServerTimestamp('not a timestamp')).toBe('not a timestamp');+ expect(normalizeServerTimestamp('2026-06-11 not-a-time')).toBe('2026-06-11 not-a-time');+ });+});diff --git a/invokeai/frontend/webv2/src/platform/time/serverTimestamp.ts b/invokeai/frontend/webv2/src/platform/time/serverTimestamp.tsnew file mode 100644index 0000000000..f5bf7a38c3--- /dev/null+++ b/invokeai/frontend/webv2/src/platform/time/serverTimestamp.ts@@ -0,0 +1,14 @@+/**+ * The backend stamps timestamps via SQLite ("2026-06-11 09:21:04.123") —+ * UTC, but with no timezone marker, which `Date` would misread as local+ * time. Normalize to ISO once, at the boundary that parses the value.+ */+export const normalizeServerTimestamp = (value: string): string => {+ if (!/^\d{4}-\d{2}-\d{2} /.test(value)) {+ return value;+ }++ const date = new Date(`${value.replace(' ', 'T')}Z`);++ return Number.isNaN(date.getTime()) ? value : date.toISOString();+};diff --git a/invokeai/frontend/webv2/src/workbench/palette/paletteProviders.ts b/invokeai/frontend/webv2/src/workbench/palette/paletteProviders.tsindex a7551939f5..eea9b84d95 100644--- a/invokeai/frontend/webv2/src/workbench/palette/paletteProviders.ts+++ b/invokeai/frontend/webv2/src/workbench/palette/paletteProviders.ts@@ -13,6 +13,7 @@ import { listLibraryWorkflows } from '@features/workflow/paletteSearch';import { requestLibraryWorkflowLoad } from '@features/workflow/react';import { queryClient } from '@platform/query/client';import { isTimestampInRange } from '@platform/search/dateTokens';+import { normalizeServerTimestamp } from '@platform/time/serverTimestamp';import { absolutizeApiUrl } from '@platform/transport/http';import type { PaletteEntry, PaletteSearchProvider } from './entries';@@ -318,7 +319,7 @@ export const createImagesProvider = ({});return page.images.map<PaletteEntry>((image) => {- const createdAt = new Date(image.queuedAt);+ const createdAt = new Date(normalizeServerTimestamp(image.queuedAt));return {group: 'Images',diff --git a/invokeai/frontend/webv2/src/workbench/projects/library.ts b/invokeai/frontend/webv2/src/workbench/projects/library.tsindex aac4aff30f..ea42a8c490 100644--- a/invokeai/frontend/webv2/src/workbench/projects/library.ts+++ b/invokeai/frontend/webv2/src/workbench/projects/library.ts@@ -1,5 +1,6 @@import { createExternalStore } from '@platform/state/externalStore';import { createSingleFlight } from '@platform/state/singleFlight';+import { normalizeServerTimestamp } from '@platform/time/serverTimestamp';import {createProject as apiCreateProject,@@ -41,21 +42,6 @@ export interface ProjectLibrarySnapshot {const store = createExternalStore<ProjectLibrarySnapshot>({ status: 'idle', summaries: [] });-/**- * The backend stamps timestamps via SQLite ("2026-06-11 09:21:04.123") —- * UTC, but with no timezone marker, which `Date` would misread as local- * time. Normalize to ISO once, here at the boundary.- */-const normalizeServerTimestamp = (value: string): string => {- if (!/^\d{4}-\d{2}-\d{2} /.test(value)) {- return value;- }-- const date = new Date(`${value.replace(' ', 'T')}Z`);-- return Number.isNaN(date.getTime()) ? value : date.toISOString();-};-const toSummary = (dto: ProjectSummaryDTO): ProjectSummary => ({createdAt: normalizeServerTimestamp(dto.created_at),id: dto.project_id,