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.98k stars 2.3k forks source link

dayjs('2022-29th', 'YYYY-wo') get wrong result #1994

Open honkinglin opened 2 years ago

honkinglin commented 2 years ago

Describe the bug https://codesandbox.io/s/adoring-estrela-ptj5o1?file=/src/index.js

image

Expected behavior 期望解析 '2022-29th' 这类字符串能得到正常的数据

Information

Bykiev commented 2 years ago

Hi, you should extend dayjs by CustomParseFormat plugin. In second console.log input string with custom format cannot be parsed without specifying the format