Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
-->
<ng-container *ngIf="(vm$ | async) as vm">
<span *ngIf="field.value">
{{toDateTime(field.value) | date:getDateTimeFormat():getUserTimeZone()}}
{{toDateTime(field.value) | date:getDateTimeFormat():getUserTimeZone(field.value)}}
</span>
</ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export class DateTimeDetailFieldComponent extends BaseDateTimeComponent{
super(formatter, typeFormatter, logic, logicDisplay);
}

getUserTimeZone(): string {
return this.formatter.userTimeZone();
getUserTimeZone(dateString): string {
return this.formatter.userTimeZone(this.formatter.toDateTime(dateString));
}

toDateTime(dateString: string): Date {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class DatetimeFormatter implements Formatter {
if (!dateTime.isValid) {
return dateString;
}
return formatDate(dateTime.toJSDate(), toFormat, this.locale, this.userTimeZone());
return formatDate(dateTime.toJSDate(), toFormat, this.locale, this.userTimeZone(dateTime));
}
return '';
}
Expand Down Expand Up @@ -329,12 +329,12 @@ export class DatetimeFormatter implements Formatter {
return !dateTime.isValid;
}

userTimeZone(): string {
userTimeZone(dateTime: DateTime): string {
let userTZ = this.preferences.getUserPreference('timezone') ?? 'GMT';
if (!userTZ) {
userTZ = 'GMT';
}
const milliseconds = DateTime.now().setZone(userTZ).toMillis();
const milliseconds = dateTime.setZone(userTZ).toMillis();
return IANAZone.create(userTZ).formatOffset(milliseconds, 'techie');
}

Expand Down