fix: timezone handling

* EPG data is stored with ISO 8601 format including timezone offset
(e.g., 2025-12-26T16:00:00+01:00)
* When displayed, moment(isoString)
parses it correctly and converts to the user's local timezone
automatically
* No settings needed — times always show in the user's
machine timezone
This commit is contained in:
4gray committed 2026-01-05 21:52:45 +01:00
1 parent ad9bf45518
commit 57246c421d
5 files changed
+16 -10

No files matched your search

@@ -1,7 +1,7 @@
<span class="time"
>{{ item.start | momentDate: 'YYYYMMDDHHmm ZZ' : 'HH:mm' }}
>{{ item.start | momentDate: 'HH:mm' }}
-
{{ item.stop | momentDate: 'YYYYMMDDHHmm ZZ' : 'HH:mm' }}</span
{{ item.stop | momentDate: 'HH:mm' }}</span
>
@if (timeNow >= item.start && timeNow <= item.stop) {
<span class="live badge" [matTooltip]="'EPG.LIVE_NOW' | translate"
@@ -33,7 +33,7 @@
<mat-icon>chevron_left</mat-icon>
</button>
<span class="selected-date">
{{ dateToday | momentDate: 'YYYY-MM-DD' : 'MMMM Do, dddd' }}</span
{{ dateToday | momentDate: 'MMMM Do, dddd' : 'YYYY-MM-DD' }}</span
>
<button
class="next-day"
@@ -30,9 +30,9 @@
}
<div class="program-timeline">
<div class="timeline-info">
<span class="time-start">{{ start | momentDate: 'YYYYMMDDHHmm ZZ' : 'HH:mm' }}</span>
<span class="time-start">{{ start | momentDate: 'HH:mm' }}</span>
<span class="time-separator">—</span>
<span class="time-end">{{ stop | momentDate: 'YYYYMMDDHHmm ZZ' : 'HH:mm' }}</span>
<span class="time-end">{{ stop | momentDate: 'HH:mm' }}</span>
</div>
<div class="progress-track">
<div
@@ -14,7 +14,7 @@
<mat-icon>chevron_left</mat-icon>
</button>
<div class="today-date">
{{ today() | momentDate: 'YYYYMMDD' : 'MMMM Do, dddd' }}
{{ today() | momentDate: 'MMMM Do, dddd' : 'YYYYMMDD' }}
</div>
<button
[matTooltip]="'EPG.NEXT_DAY' | translate"
+10 -4
View File
@@ -2,7 +2,9 @@ import { Pipe, PipeTransform } from '@angular/core';
import moment from 'moment';
/**
* Moment.js based pipe to parse and return the provided date based on given params
* Moment.js based pipe to parse and return the provided date based on given params.
* Auto-detects ISO 8601 format and converts to user's local timezone.
* Optionally accepts a format string for non-ISO date strings.
*/
@Pipe({
name: 'momentDate',
@@ -11,9 +13,13 @@ import moment from 'moment';
export class MomentDatePipe implements PipeTransform {
transform(
value: string,
formatToParse: string,
formatToReturn = 'MMMM Do, dddd'
formatToReturn = 'MMMM Do, dddd',
formatToParse?: string
): string {
return moment(value, formatToParse).format(formatToReturn);
// If formatToParse is provided, use it; otherwise auto-detect (works for ISO 8601)
const parsed = formatToParse
? moment(value, formatToParse)
: moment(value);
return parsed.format(formatToReturn);
}
}