Files
micro-frontend/accounting-ng-nuttakit/src/app/pipe/dtmtodatetime.pipe.ts

25 lines
569 B
TypeScript
Raw Normal View History

import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'dtmtodatetime',
standalone: false
})
export class AccDateFormatPipe implements PipeTransform {
transform(value: string | number): string {
if (value === null || value === undefined) return '';
const str = value.toString();
if (str.length !== 12) return str;
const dd = str.slice(0, 2);
const mm = str.slice(2, 4);
const yyyy = str.slice(4, 8);
const hh = str.slice(8, 10);
const min = str.slice(10, 12);
return `${dd}/${mm}/${yyyy} ${hh}:${min}`;
}
}