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=fac98484a893fee01fcd41832d072f096ca35663;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 431ca1428e..50479a818c 100644 --- a/Open-ILS/src/eg2/src/app/core/core.module.ts +++ b/Open-ILS/src/eg2/src/app/core/core.module.ts @@ -5,14 +5,17 @@ * and do not require entry in our 'providers' array. */ import {NgModule} from '@angular/core'; -import {CommonModule, DatePipe, DecimalPipe} from '@angular/common'; -import {FormatValuePipe, OrgDateInContextPipe, DueDatePipe} from './format.service'; +import {CommonModule, DatePipe, DecimalPipe, CurrencyPipe} from '@angular/common'; +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 {FormatValuePipe, OrgDateInContextPipe, DueDatePipe} from './format.servi 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 b58f5516e6..c4c67f3111 100644 --- a/Open-ILS/src/eg2/src/app/core/format.service.ts +++ b/Open-ILS/src/eg2/src/app/core/format.service.ts @@ -372,12 +372,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) {}