How do you display a JavaScript datetime object in the 12 hour format (AM/PM)?
My suggestion is use moment js for date and time operation.
https://momentjs.com/docs/#/displaying/format/
console.log(moment().format('hh:mm a'));