| author | |
| committer | |
| log | 20a70420a85aecab0bde1a58921197f423e401cc |
| tree | 2a06491e32c52c8a7ee699b36cb79244a3d95dce |
| parent | ec141c125726ae70f31f392e780afa8de446fdc4 |
| signature | Signed by PGP key B5690EEEBB952194 |
Co-authored-by: codex <codex@users.noreply.github.com>2 files changed, 16 insertions(+), 2 deletions(-)
apps/web/src/timestampFormat.test.ts+14| ... | ... | @@ -176,6 +176,20 @@ describe("formatDayAwareTimestamp", () => { |
| 176 | 176 | ); |
| 177 | 177 | }); |
| 178 | 178 | |
| 179 | it("uses the host locale for both the numeric date and wall-clock time", async () => { | |
| 180 | vi.stubGlobal("window", { | |
| 181 | desktopBridge: { getSystemLocale: () => "en-GB" }, | |
| 182 | }); | |
| 183 | vi.resetModules(); | |
| 184 | ||
| 185 | const { formatDayAwareTimestamp: formatWithHostLocale } = await import("./timestampFormat"); | |
| 186 | const messageAt = iso(2026, 7, 12, 15, 44); | |
| 187 | ||
| 188 | expect(formatWithHostLocale(messageAt, "locale", now)).toBe("12/08 15:44"); | |
| 189 | ||
| 190 | vi.unstubAllGlobals(); | |
| 191 | }); | |
| 192 | ||
| 179 | 193 | it("returns an empty string for invalid input", () => { |
| 180 | 194 | expect(formatDayAwareTimestamp("not-a-date", "12-hour", now)).toBe(""); |
| 181 | 195 | }); |
apps/web/src/timestampFormat.ts+2-2| ... | ... | @@ -127,11 +127,11 @@ export function formatShortTimestamp(isoDate: string, timestampFormat: Timestamp |
| 127 | 127 | return getTimestampFormatter(timestampFormat, false).format(date); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | const numericDateFormatter = new Intl.DateTimeFormat(undefined, { | |
| 130 | const numericDateFormatter = new Intl.DateTimeFormat(timestampLocale, { | |
| 131 | 131 | month: "numeric", |
| 132 | 132 | day: "numeric", |
| 133 | 133 | }); |
| 134 | const numericDateWithYearFormatter = new Intl.DateTimeFormat(undefined, { | |
| 134 | const numericDateWithYearFormatter = new Intl.DateTimeFormat(timestampLocale, { | |
| 135 | 135 | month: "numeric", |
| 136 | 136 | day: "numeric", |
| 137 | 137 | year: "numeric", |