dayjs icon indicating copy to clipboard operation
dayjs copied to clipboard

dayjs("02-29") return “2001-03-01”

Open HDRorz opened this issue 1 year ago • 1 comments

Describe the bug In chrome and nodejs, dayjs("02-29") return “2001-03-01”.

Expected behavior I think "02-29" should be a invalid input. In firefox, this cause a error "Invalid Date". It's OK. In chrome, the dafault year "2001" makes it even worse. There is no "2001-02-29", but chrome/v8 makes it to be "2001-03-01". It's certainly wrong. (Maybe also a bug to v8.)

Information

  • Day.js Version 1.11.10
  • OS: windows 7 - 10
  • Browser chrome 109.0.5414.120 - 122.0.6261.95
  • Time zone: GMT+0800 Asia/Shanghai

HDRorz avatar Mar 01 '24 07:03 HDRorz

I have observed similar issue. Sending "2/31" is converting it to "3/2". Ideally it should be an invalid input and should throw validation error.

aashishpsaini avatar Mar 04 '24 14:03 aashishpsaini