I am trying to convert 18:00:00.000 to 24H (18:00) and 12H (6PM) formats using date-fns. However, the input value of 18:00:00.000 gives a "RangeError: invalid time value".
My code
dateFns.format(new Date(18:00:00.000), 'H:mm')
I have no problem if I pass the time in the dateTime format such as 2022-01-04T11:00:00.000Z but I just need the time (hours and minutes).