dayjs
dayjs copied to clipboard
Check of an invalid date returns true on Firefox (isValid())
The Issue
isValid() not behaving the same on different browser, it returns false on Chrome / Safari as expected but returns true on Firefox.
The string that was sent to the validator has no relation with dates "JUNKIE (SWE)", see screenshot:
Chrome:
Fiirefox:
Expected behavior An invalid date should always returns false on all browsers the same way.
Information
- Day.js Version 1.10.7
- OS: MacOS
- Browser: Firefox 125.0.3
- Time zone: UTC+2
hi @JSeifBY, i'm facing the same issue as you.
the root cause is the difference between FireFox and Chrome engines.
you can try with this function
new Date('JUNKIE (SWE)')
on Chrome
- expected: Invalid Date
- actual: Invalid Date
on Firefox
- expected: Invalid Date
- actual:
Date Fri Jun 01 2001 00:00:00 GMT+0700 (Indochina Time)
I think we should raise this issue with Mozilla 😂