From d590388176090ca71054df2557e182be265af10e Mon Sep 17 00:00:00 2001 From: WolfieLeader Date: Thu, 19 Mar 2026 03:43:49 +0200 Subject: [PATCH 1/2] fix(util): format collapsibleDate time without locale dependency (#1494) --- ark/util/serialize.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/ark/util/serialize.ts b/ark/util/serialize.ts index db6f8bd79b..4edbff66b1 100644 --- a/ark/util/serialize.ts +++ b/ark/util/serialize.ts @@ -203,18 +203,15 @@ export const describeCollapsibleDate = (date: Date): string => { if (hours === 0 && minutes === 0 && seconds === 0 && milliseconds === 0) return datePortion - let timePortion = date.toLocaleTimeString() + const h = hours % 12 || 12 + const suffix = hours < 12 ? " AM" : " PM" - const suffix = - timePortion.endsWith(" AM") || timePortion.endsWith(" PM") ? - timePortion.slice(-3) - : "" - - if (suffix) timePortion = timePortion.slice(0, -suffix.length) + let timePortion = + seconds || milliseconds ? + `${h}:${pad(minutes, 2)}:${pad(seconds, 2)}` + : `${h}:${pad(minutes, 2)}` if (milliseconds) timePortion += `.${pad(milliseconds, 3)}` - else if (timeWithUnnecessarySeconds.test(timePortion)) - timePortion = timePortion.slice(0, -3) return `${timePortion + suffix}, ${datePortion}` } From 8e7eb8da5fda2c41309f41d88babe9e42e6934a8 Mon Sep 17 00:00:00 2001 From: WolfieLeader Date: Thu, 19 Mar 2026 04:08:13 +0200 Subject: [PATCH 2/2] fix: remove unused timeWithUnnecessarySeconds regex --- ark/util/serialize.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/ark/util/serialize.ts b/ark/util/serialize.ts index 4edbff66b1..bac5a5fe12 100644 --- a/ark/util/serialize.ts +++ b/ark/util/serialize.ts @@ -231,7 +231,5 @@ const months = [ "December" ] -const timeWithUnnecessarySeconds = /:\d\d:00$/ - const pad = (value: number, length: number) => String(value).padStart(length, "0")