It will be better to use momentjs
Just a little conversation "2 PM" to "14.00"
const number = moment("02:00 PM", ["h:mm A"]).format("HH:mm");
cosole.log(number);
// "14.00" "14.00" to "2 PM"
const number = moment("14.00", ["HH.mm"]).format("hh:mm a");
cosole.log(number); // "02:00 pm"