File: /var/www/web.enelar.com.co/src/pipes/hora-format.pipe.ts
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'horaFormat',
})
export class HoraFormatPipe implements PipeTransform {
transform(value: string): string {
console.log('Fecha', value)
if (!value) return value;
const fecha = new Date(value);
const horas = fecha.getHours();
const minutos = fecha.getMinutes();
const ampm = horas >= 12 ? 'PM' : 'AM';
const horas12 = horas % 12 === 0 ? 12 : horas % 12;
return `${horas12}:${minutos.toString().padStart(2, '0')} ${ampm}`;
}
}