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.69k stars 2.28k forks source link

week使用没有到达预期效果,看起来可能是个bug #2021

Open zhangqh22 opened 2 years ago

zhangqh22 commented 2 years ago

取week的时候,日期错误,例如dayjs().week(1),结果错误 dayjs("2022-8-8").week(1).format("YYYY-MM-DD") //2021-12-27 dayjs("2022-8-9").week(1).format("YYYY-MM-DD") //2021-12-28

Bykiev commented 2 years ago

Hi, week() function is locale specific, so you should import your locale before. Here is a demo with Russian locale.

iamkun commented 2 years ago

@zhangqh22 please refer to @Bykiev 's explanation

zhangqh22 commented 2 years ago

多谢,thank you too much