feat(provenance): locale-independent formatPostDate util
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { formatPostDate } from '../src/utils/date.js'
|
||||
|
||||
describe('formatPostDate', () => {
|
||||
it('formats an ISO datetime as "Mon D, YYYY" in UTC', () => {
|
||||
expect(formatPostDate('2023-08-01T00:00:00+00:00')).toBe('Aug 1, 2023')
|
||||
expect(formatPostDate('2023-12-25T23:59:59Z')).toBe('Dec 25, 2023')
|
||||
})
|
||||
|
||||
it('returns null for null/empty/invalid', () => {
|
||||
expect(formatPostDate(null)).toBe(null)
|
||||
expect(formatPostDate('')).toBe(null)
|
||||
expect(formatPostDate('not-a-date')).toBe(null)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user