dayjs icon indicating copy to clipboard operation
dayjs copied to clipboard

dayjs('10-10').format('MM.DD') get 10.01 in iOS

Open go4sharing opened this issue 11 months ago • 1 comments

Describe the bug When using dayjs('10-10').format('MM.DD') on iOS (Safari), the result is 10.01 instead of the expected 10.10.

Expected behavior The expected result should be 10.10 when formatting the date as MM.DD.

Information

  • Day.js Version [e.g. v1.0.0]
  • OS: [iOS]
  • Browser [safari]
  • Time zone: [e.g. GMT-07:00 DST (Pacific Daylight Time)]

go4sharing avatar Mar 19 '25 09:03 go4sharing

It seems that Date behaves differently in Safari browser than in other browsers. I added exception handling code for cases where input is in MM-DD format.

jayur830 avatar Mar 23 '25 08:03 jayur830

For consistent results parsing anything other than ISO 8601 strings, you should use String + Format. https://day.js.org/docs/en/parse/string-format

iamkun avatar Aug 29 '25 04:08 iamkun