arco-design-vue icon indicating copy to clipboard operation
arco-design-vue copied to clipboard

Don't update global dayjs locale but make sure dayStartOfWeek can work properly

Open pzgz opened this issue 7 months ago • 1 comments
trafficstars

Types of changes

  • [ ] New feature
  • [x] Bug fix
  • [ ] Enhancement
  • [ ] Component style change
  • [ ] Typescript definition change
  • [ ] Documentation change
  • [ ] Coding style change
  • [ ] Refactoring
  • [ ] Test cases
  • [ ] Continuous integration
  • [ ] Breaking change
  • [ ] Others

Background and context

fixing for:

  • #3021
  • #3039
  • #3509

Basically, I don't think we need to update global dayjs locale with dayStartOfWeek set in date-picker component, doing this will make impact on global dayjs component. And we can see the inconsistent behaviors caused by this action in issue #3509.

Solution

  • Don't update global dayjs locale with dayStartOfWeek value passed to date-picker
  • But when getting week in year value when rendering week picker, make sure dayStartOfWeek get considered properly

How is the change tested?

Check the two week pickers in date-picker page, when dayStartOfWeek is 0, 2025 has 53 weeks, at the second week picker with dayStartOfWeek = 1 , we should have 52 weeks in 2025.

Changelog

Component Changelog(CN) Changelog(EN) Related issues
date-picker 不修改dayjs全局locale配置 Don't change global dayjs locale settings #3021, #3039, #3509

pzgz avatar Apr 20 '25 12:04 pzgz

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders
Open Preview

codesandbox[bot] avatar Apr 20 '25 12:04 codesandbox[bot]