If you're working on the browser, specifically with Firefox + Vue + typescript, here's my date string:
2021-02-05 12:00 AM
However, when I include the AM/PM in the code like this:
const dateObj: any = dayjs('2021-02-05 12:00 AM').format('YYYY-MM-DD hh:mm A');
The dateObj
output is always "Invalid Date". Removing the "AM" from the string allows it to parse correctly. Even testing with an online tool like this one gives me a strange result:
NaN-NaN-NaN NaN:NaN PM
Interestingly, without the "AM," everything works fine for me.
Any thoughts or suggestions on how to resolve this issue?
EDIT: It seems to work on Chrome but not Firefox...