-3

I have a custom Date and I am trying to format it using | date: 'dd LLLL yyyy hh:mm aa' pipe so the result is - 30 August 2022 12:00 PM, but I want this date in 30 August 2022 12:00 pm/am formate how can I do that,

<ng-container *ngIf="date else empty">
  {{date | date: 'dd LLLL yyyy hh:mm aa'}}
</ng-container>

result - 30 August 2022 12:00 PM

expectation - 30 August 2022 12:00 pm

1 Answers1

0

It should do the work :

let date = '30 August 2022 12:00 PM'.split(' ');
let end = date.pop().toLowerCase();
let result = [...date, end].join(' ');
console.log(result);
// Output
// 30 August 2022 12:00 pm
nem0z
  • 1,060
  • 1
  • 4
  • 17