diff --git a/pkgs/id/crates/id-web/src/templates.rs b/pkgs/id/crates/id-web/src/templates.rs index 078753fe8a..ec9ed56641 100644 --- a/pkgs/id/crates/id-web/src/templates.rs +++ b/pkgs/id/crates/id-web/src/templates.rs @@ -576,7 +576,7 @@ pub fn render_editor(doc_id: &str, name: &str, content: &str, hash: &str) -> Str html.push_str(" \n"); html.push_str(" \n"); html.push_str(" \n"); - html.push_str(" \n"); + html.push_str(" \n"); html.push_str(" \n"); html.push_str(" \n"); diff --git a/pm-stack/aggregator/src/notifications.ts b/pm-stack/aggregator/src/notifications.ts index 667358dd6b..c6b1d31e3c 100644 --- a/pm-stack/aggregator/src/notifications.ts +++ b/pm-stack/aggregator/src/notifications.ts @@ -225,16 +225,23 @@ interface LocalClock { minute: number; } +// ⚡ Bolt: formatter construction (~29µs) dominated repeated digest clock +// conversions. Reuse the immutable formatter for each timezone. +const LOCAL_CLOCK_FORMATTERS = new Map(); +function localClockFormatter(timeZone: string): Intl.DateTimeFormat { + let fmt = LOCAL_CLOCK_FORMATTERS.get(timeZone); + if (!fmt) { + fmt = new Intl.DateTimeFormat("en-US", { + timeZone, year: "numeric", month: "2-digit", day: "2-digit", + hour: "2-digit", minute: "2-digit", hourCycle: "h23", + }); + LOCAL_CLOCK_FORMATTERS.set(timeZone, fmt); + } + return fmt; +} + function localClock(at: number, timeZone: string): LocalClock { - const parts = new Intl.DateTimeFormat("en-US", { - timeZone, - year: "numeric", - month: "2-digit", - day: "2-digit", - hour: "2-digit", - minute: "2-digit", - hourCycle: "h23", - }).formatToParts(new Date(at)); + const parts = localClockFormatter(timeZone).formatToParts(new Date(at)); const value = (type: Intl.DateTimeFormatPartTypes) => Number(parts.find((part) => part.type === type)?.value); return { year: value("year"),