Make profile SSR formatting deterministic

This commit is contained in:
2026-08-29 20:24:38 +02:00
parent 872f420190
commit 99d94c9333
5 changed files with 86 additions and 4 deletions
@@ -0,0 +1,16 @@
import { describe, expect, it } from 'vitest'
import { formatProfileDate, formatProfileNumber } from './profileFormatters'
describe('profile formatters', () => {
it('uses a stable en-US number format independent of the browser locale', () => {
expect(formatProfileNumber(9529106)).toBe('9,529,106')
})
it('uses UTC for stable calendar dates at timezone boundaries', () => {
expect(formatProfileDate('2024-01-01T00:30:00.000Z', {
month: 'long',
day: 'numeric',
year: 'numeric',
})).toBe('January 1, 2024')
})
})