Fixed invalid date showing on tasks screen

This commit is contained in:
Joseph Milazzo 2023-12-05 08:22:31 -06:00
parent 2dbaf555a5
commit 89452cc924
2 changed files with 5 additions and 2 deletions

View file

@ -15,7 +15,8 @@ type UtcToLocalTimeFormat = 'full' | 'short' | 'shortDate' | 'shortTime';
})
export class UtcToLocalTimePipe implements PipeTransform {
transform(utcDate: string, format: UtcToLocalTimeFormat = 'short'): string {
transform(utcDate: string | undefined | null, format: UtcToLocalTimeFormat = 'short'): string {
if (utcDate === undefined || utcDate === null) return '';
const browserLanguage = navigator.language;
const dateTime = DateTime.fromISO(utcDate, { zone: 'utc' }).toLocal().setLocale(browserLanguage);

View file

@ -58,7 +58,9 @@
<td>
{{task.title | titlecase}}
</td>
<td>{{task.lastExecutionUtc | utcToLocalTime | defaultValue }}</td>
<td>
{{task.lastExecutionUtc | utcToLocalTime | defaultValue }}
</td>
<td>{{task.cron}}</td>
</tr>
</tbody>