2025-11-13 18:00:51 +07:00
|
|
|
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;
|
|
|
|
|
|
2025-11-21 19:35:46 +07:00
|
|
|
const yyyy = str.slice(0, 4);
|
|
|
|
|
const mm = str.slice(4, 6);
|
|
|
|
|
const dd = str.slice(6, 8);
|
2025-11-13 18:00:51 +07:00
|
|
|
const hh = str.slice(8, 10);
|
|
|
|
|
const min = str.slice(10, 12);
|
|
|
|
|
|
|
|
|
|
return `${dd}/${mm}/${yyyy} ${hh}:${min}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|