diff --git a/src/portal/src/app/base/left-side-nav/replication/replication/replication-tasks/replication-tasks.component.html b/src/portal/src/app/base/left-side-nav/replication/replication/replication-tasks/replication-tasks.component.html
index fcc701053..dc0e7cb16 100644
--- a/src/portal/src/app/base/left-side-nav/replication/replication/replication-tasks/replication-tasks.component.html
+++ b/src/portal/src/app/base/left-side-nav/replication/replication/replication-tasks/replication-tasks.component.html
@@ -109,7 +109,7 @@
{{t.operation}}
{{getStatusStr(t.status)}}
{{t.start_time | harborDatetime: 'short'}}
- {{t.end_time && t.end_time != '0001-01-01T00:00:00Z' ? (t.end_time | harborDatetime: 'short') : "-"}}
+ {{t.end_time | harborDatetime: 'short'}}
diff --git a/src/portal/src/app/shared/pipes/harbor-datetime.pipe.ts b/src/portal/src/app/shared/pipes/harbor-datetime.pipe.ts
index 38cfc8a84..a962f23bf 100644
--- a/src/portal/src/app/shared/pipes/harbor-datetime.pipe.ts
+++ b/src/portal/src/app/shared/pipes/harbor-datetime.pipe.ts
@@ -2,18 +2,23 @@ import { Pipe, PipeTransform } from '@angular/core';
import { DatePipe } from "@angular/common";
import { DEFAULT_LANG_LOCALSTORAGE_KEY, DeFaultLang } from "../entities/shared.const";
+const baseTimeLine: Date = new Date('1970-1-1');
+
@Pipe({
- name: 'harborDatetime',
- pure: false
+ name: 'harborDatetime',
+ pure: false
})
export class HarborDatetimePipe implements PipeTransform {
- transform(value: any, format?: string): string {
- let lang: string = DeFaultLang;
- if (localStorage && localStorage.getItem(DEFAULT_LANG_LOCALSTORAGE_KEY)) {
- lang = localStorage.getItem(DEFAULT_LANG_LOCALSTORAGE_KEY);
+ transform(value: any, format?: string): string {
+ let lang: string = DeFaultLang;
+ if (localStorage && localStorage.getItem(DEFAULT_LANG_LOCALSTORAGE_KEY)) {
+ lang = localStorage.getItem(DEFAULT_LANG_LOCALSTORAGE_KEY);
+ }
+ if (value && value <= baseTimeLine) {// invalid date
+ return '-';
+ }
+ // default format medium
+ return new DatePipe(lang).transform(value, format ? format : 'medium');
}
- // default format medium
- return new DatePipe(lang).transform(value, format ? format : 'medium');
- }
}