From: Bill Erickson Date: Wed, 14 Jul 2021 22:05:20 +0000 (-0400) Subject: LP1936233 More simple date pipes X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=136953e57048e2cd9793851ffc304a725e9810c8;p=working%2FEvergreen.git LP1936233 More simple date pipes Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/core/core.module.ts b/Open-ILS/src/eg2/src/app/core/core.module.ts index 4bb6c67b09..e855b13e0f 100644 --- a/Open-ILS/src/eg2/src/app/core/core.module.ts +++ b/Open-ILS/src/eg2/src/app/core/core.module.ts @@ -6,13 +6,16 @@ */ import {NgModule} from '@angular/core'; import {CommonModule, DatePipe, CurrencyPipe} from '@angular/common'; -import {FormatService, FormatValuePipe, OrgDateInContextPipe, DueDatePipe} from './format.service'; +import {FormatService, FormatValuePipe, OrgDateInContextPipe, + DueDatePipe, SimpleDatePipe, SimpleDateTimePipe} from './format.service'; @NgModule({ declarations: [ FormatValuePipe, OrgDateInContextPipe, - DueDatePipe + DueDatePipe, + SimpleDatePipe, + SimpleDateTimePipe ], imports: [ CommonModule @@ -21,7 +24,9 @@ import {FormatService, FormatValuePipe, OrgDateInContextPipe, DueDatePipe} from CommonModule, FormatValuePipe, OrgDateInContextPipe, - DueDatePipe + DueDatePipe, + SimpleDatePipe, + SimpleDateTimePipe ], providers: [ DatePipe, diff --git a/Open-ILS/src/eg2/src/app/core/format.service.ts b/Open-ILS/src/eg2/src/app/core/format.service.ts index fa92227c84..521d0197f0 100644 --- a/Open-ILS/src/eg2/src/app/core/format.service.ts +++ b/Open-ILS/src/eg2/src/app/core/format.service.ts @@ -367,12 +367,36 @@ export class FormatService { @Pipe({name: 'formatValue'}) export class FormatValuePipe implements PipeTransform { constructor(private formatter: FormatService) {} - // Add other filter params as needed to fill in the FormatParams transform(value: string, datatype: string): string { return this.formatter.transform({value: value, datatype: datatype}); } } +@Pipe({name: 'egDate'}) +export class SimpleDatePipe implements PipeTransform { + constructor(private formatter: FormatService) {} + + transform(value: string): string { + return this.formatter.transform({ + value: value, + datatype: 'timestamp' + }); + } +} + +@Pipe({name: 'egDateTime'}) +export class SimpleDateTimePipe implements PipeTransform { + constructor(private formatter: FormatService) {} + + transform(value: string): string { + return this.formatter.transform({ + value: value, + datatype: 'timestamp', + datePlusTime: true + }); + } +} + @Pipe({name: 'egOrgDateInContext'}) export class OrgDateInContextPipe implements PipeTransform { constructor(private formatter: FormatService) {}