Issue on Firefox
If you deeply look at the implementation, you would see above day string going through the Day
constructor: new Day('2021-02-05 12:00 AM')
. Unfortunately FF doesn't support this support this day string format, but Chrome does.
Best approach
As the document mentioned as below:
For consistent results parsing anything other than ISO 8601 strings, you should use String + Format.
If you're still keen to use above format, you would have to use a plugin as mentioned here
Basically, you have to change as below to work in all browsers:
import customParseFormat from 'dayjs/plugin/customParseFormat'
import dayjs from "dayjs"
dayjs.extend(customParseFormat)
const yourDate = dayjs('2021-02-05 12:00 AM', 'YYYY-MM-DD HH:mm A')
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…