refactor: refactor date handling across components to use date-fns and Intl.DateTimeFormat

- 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
This commit is contained in:
4gray committed 2026-04-11 10:41:33 +02:00
1 parent d3e30056f6
commit c97673b928
29 files changed
+410 -247

No files matched your search

@@ -14,6 +14,7 @@ import { MatIcon } from '@angular/material/icon';
import { MatMenuModule } from '@angular/material/menu';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatTooltipModule } from '@angular/material/tooltip';
import { formatWithIntl } from '@iptvnator/pipes';
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
import { startWith } from 'rxjs';
import {
@@ -213,16 +214,12 @@ export class GlobalFavoritesWidgetComponent implements OnInit {
return this.translate.instant('WORKSPACE.DASHBOARD.RECENTLY');
}
return date.toLocaleString(
this.translate.currentLang ||
this.translate.defaultLang ||
undefined,
{
month: 'short',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
}
);
return formatWithIntl(date, {
locale: this.translate.currentLang || this.translate.defaultLang,
month: 'short',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
});
}
}
@@ -13,6 +13,7 @@ import { MatIcon } from '@angular/material/icon';
import { MatMenuModule } from '@angular/material/menu';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatTooltipModule } from '@angular/material/tooltip';
import { formatWithIntl } from '@iptvnator/pipes';
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
import { startWith } from 'rxjs';
import {
@@ -212,16 +213,12 @@ export class RecentlyWatchedWidgetComponent implements OnInit {
return this.translate.instant('WORKSPACE.DASHBOARD.RECENTLY');
}
return date.toLocaleString(
this.translate.currentLang ||
this.translate.defaultLang ||
undefined,
{
month: 'short',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
}
);
return formatWithIntl(date, {
locale: this.translate.currentLang || this.translate.defaultLang,
month: 'short',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
});
}
}