mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-10 18:36:15 -08:00
- Replaced moment.js usage with Intl.DateTimeFormat for date formatting in various components. - Introduced utility functions `normalizeDateLocale` and `formatWithIntl` for locale normalization and date formatting. - Updated PlaylistSwitcher, RecentPlaylists, ContentCard, EPG components, and MultiEpgContainer to utilize the new date formatting approach. - Removed moment-date pipe and related tests, simplifying date handling logic. - Ensured all date displays respect the current locale settings. Entire-Checkpoint: 271bd0162027
25 lines
858 B
TypeScript
25 lines
858 B
TypeScript
import { formatWithIntl, normalizeDateLocale } from './date-format.util';
|
|
|
|
describe('date-format.util', () => {
|
|
it('normalizes app locale aliases to Angular/Intl locale ids', () => {
|
|
expect(normalizeDateLocale('ary')).toBe('ar-MA');
|
|
expect(normalizeDateLocale('by')).toBe('be');
|
|
expect(normalizeDateLocale('zhtw')).toBe('zh-Hant');
|
|
expect(normalizeDateLocale('de')).toBe('de');
|
|
expect(normalizeDateLocale()).toBe('en');
|
|
});
|
|
|
|
it('formats dates with cached Intl formatters', () => {
|
|
expect(
|
|
formatWithIntl('2026-04-05T12:30:00.000Z', {
|
|
locale: 'de',
|
|
timeZone: 'UTC',
|
|
month: 'short',
|
|
day: 'numeric',
|
|
hour: '2-digit',
|
|
minute: '2-digit',
|
|
})
|
|
).toContain('12:30');
|
|
});
|
|
});
|