Skip to content

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

Open
pzgz wants to merge 9 commits into
arco-design:mainfrom
pzgz:main
Open

Don't update global dayjs locale but make sure dayStartOfWeek can work properly#3518
pzgz wants to merge 9 commits into
arco-design:mainfrom
pzgz:main

Conversation

@pzgz

@pzgz pzgz commented Apr 20, 2025

Copy link
Copy Markdown

Types of changes

  • New feature
  • 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:

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 added 2 commits April 20, 2025 19:55
- No need up update global dayjs instance locale with weekStart
- weekStart only need to be used when populate week of year
@codesandbox

codesandbox Bot commented Apr 20, 2025

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant