Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

date-picker week,周计算误差 #6617

Open
5 tasks done
liuhaozhi opened this issue Dec 13, 2024 · 1 comment
Open
5 tasks done

date-picker week,周计算误差 #6617

liuhaozhi opened this issue Dec 13, 2024 · 1 comment
Labels
untriaged need to sort

Comments

@liuhaozhi
Copy link

Describe the bug

在使用date-pick ,type为week时,如果我们设置了first-day-of-week属性,那么我们得到的周结果跟实际周会有误差。

Steps to reproduce

1:版本2.40.2
2:使用date-picker组件,设置first-day-of-week为6(也就是周日为起始日期)
3:设置value为2024年十二月八号的时间戳(初步已经看到,本周应该是2024年第五十周,但组件得到49周)
4:切换周,总比实际周少1.

Link to minimal reproduction

none

System Info

"naive-ui": "^2.40.2",
 "vue": "3.3.4",

Used Package Manager

npm

Validations

@liuhaozhi liuhaozhi added the untriaged need to sort label Dec 13, 2024
@liuhaozhi
Copy link
Author

看起来原因是,周的value取的是面板上第一个日期的时间戳,当把周日作为起始的时候,计算逻辑却没有更新,导致起始日期是上一周的最后一天,计算成了上一周。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged need to sort
Projects
None yet
Development

No branches or pull requests

1 participant