diff options
Diffstat (limited to 'src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/cd-date.pipe.ts')
-rw-r--r-- | src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/cd-date.pipe.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/cd-date.pipe.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/cd-date.pipe.ts new file mode 100644 index 000000000..911f32041 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/cd-date.pipe.ts @@ -0,0 +1,20 @@ +import { DatePipe } from '@angular/common'; +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'cdDate' +}) +export class CdDatePipe implements PipeTransform { + constructor(private datePipe: DatePipe) {} + + transform(value: any): any { + if (value === null || value === '') { + return ''; + } + return ( + this.datePipe.transform(value, 'shortDate') + + ' ' + + this.datePipe.transform(value, 'mediumTime') + ); + } +} |