Spaces:
Sleeping
Sleeping
Download src/lib/format.test.ts from brestok/supplier-segmentation: direct link, hf CLI and curl.
- Browser
- Download file 656 Bytes
-
https://huggingface.co/spaces/brestok/supplier-segmentation/resolve/main/src/lib/format.test.ts
- Command line
-
hf download hf://spaces/brestok/supplier-segmentation/src/lib/format.test.ts
-
curl -L -o format.test.ts https://huggingface.co/spaces/brestok/supplier-segmentation/resolve/main/src/lib/format.test.ts
656 Bytes
| import { formatDate, parseDate } from './format'; | |
| test('dates are shown day first, dot separated', () => { | |
| expect(formatDate('2026-09-22')).toBe('22.09.2026'); | |
| expect(formatDate('2026-09-21T11:12:24.805020')).toBe('21.09.2026'); | |
| expect(formatDate(null)).toBe('—'); | |
| }); | |
| test('a typed European date is read as ISO, and only when it is a real day', () => { | |
| expect(parseDate('22.09.2026')).toBe('2026-09-22'); | |
| expect(parseDate('4/9/2026')).toBe('2026-09-04'); | |
| expect(parseDate('04-09-2026')).toBe('2026-09-04'); | |
| expect(parseDate('31.02.2026')).toBeNull(); | |
| expect(parseDate('2026-09-22')).toBeNull(); | |
| expect(parseDate('')).toBeNull(); | |
| }); | |