From 0314e87c3f8afb8499ef13633e37d06b130313cd Mon Sep 17 00:00:00 2001 From: harry Date: Wed, 17 Jun 2026 20:46:15 +0500 Subject: [PATCH] remove patch file --- timestamp-tz.patch | 137 --------------------------------------------- 1 file changed, 137 deletions(-) delete mode 100644 timestamp-tz.patch diff --git a/timestamp-tz.patch b/timestamp-tz.patch deleted file mode 100644 index 539c2c2..0000000 --- a/timestamp-tz.patch +++ /dev/null @@ -1,137 +0,0 @@ -Format timestamps as Asia/Dushanbe (UTC+5) - -SQLite stores all timestamps as UTC via datetime('now'). The UI was -rendering them raw (e.g. "2026-05-18 15:42:03"), which is 5 hours -behind local time for Tajikistan. - -Add formatTs() to the i18n store alongside formatMoney/localized. -It appends 'Z' so JS Date treats the SQLite string as UTC, then -formats with Intl using the Asia/Dushanbe timezone (ru-RU locale). - -Replace all bare timestamp renders on: -- / (dashboard: recent movements created_at) -- /parts/[id] (part created_at, updated_at, movement history) -- /invoices/[id] (invoice saved_at on receipt) -- /admin/reports (recent sales saved_at; replaces local formatWhen) - -Tested: UTC "2026-05-18 15:42:03" -> "18.05.2026, 20:42" (pass) - UTC "2026-05-18 00:30:00" -> "18.05.2026, 05:30" (pass) - null/empty/invalid input handled gracefully (pass) - -Co-Authored-By: Claude Sonnet 4.6 ---- - src/lib/i18n/store.js | 15 +++++++++++++++ - src/routes/+page.svelte | 2 +- - src/routes/admin/reports/+page.svelte | 9 +-------- - src/routes/invoices/[id]/+page.svelte | 2 +- - src/routes/parts/[id]/+page.svelte | 4 ++-- - 5 files changed, 20 insertions(+), 12 deletions(-) - -diff --git a/src/lib/i18n/store.js b/src/lib/i18n/store.js ---- a/src/lib/i18n/store.js -+++ b/src/lib/i18n/store.js -@@ -1,3 +1,18 @@ -+// formatTs: convert a SQLite UTC timestamp string ("YYYY-MM-DD HH:MM:SS") -+// to a human-readable local time in Asia/Dushanbe (UTC+5). -+// The appended 'Z' is critical — without it JS parses as local time. -+export function formatTs(utcStr) { -+ if (!utcStr) return ''; -+ const d = new Date(utcStr.replace(' ', 'T') + 'Z'); -+ if (isNaN(d.getTime())) return utcStr; -+ return d.toLocaleString('ru-RU', { -+ timeZone: 'Asia/Dushanbe', -+ day: '2-digit', -+ month: '2-digit', -+ year: 'numeric', -+ hour: '2-digit', -+ minute: '2-digit', -+ }); -+} -+ -diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte ---- a/src/routes/+page.svelte -+++ b/src/routes/+page.svelte -@@ -1,6 +1,6 @@ - -@@ -139,7 +132,7 @@ - {#each recentSales as s} - -- {formatWhen(s.saved_at)} -+ {formatTs(s.saved_at)} - {s.line_count} - -diff --git a/src/routes/invoices/[id]/+page.svelte b/src/routes/invoices/[id]/+page.svelte ---- a/src/routes/invoices/[id]/+page.svelte -+++ b/src/routes/invoices/[id]/+page.svelte -@@ -1,6 +1,6 @@ -