iamkun / dayjs

⏰ Day.js 2kB immutable date-time library alternative to Moment.js with the same modern API
https://day.js.org
MIT License
46.37k stars 2.27k forks source link

[isValid] function not works properly. #2498

Open heuhiu opened 8 months ago

heuhiu commented 8 months ago

Describe the bug How the hell on earth with any string + one random number at the end with space -> the .isValid() is still return true dayjs(what_ever_string_you_input 999).isValid()) -> true ?

Expected behavior It should return false instead.

Information

ljgaro commented 5 months ago

This! It makes no sense. The same happens with the native JS Date object.

Dharmang92 commented 5 months ago

Facing same issue. Any update?

Dharmang92 commented 5 months ago

This works properly in date-fns: https://github.com/date-fns/date-fns/tree/main/src/isValid