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

fix: locale format not working error #688

Conversation

Wxh16144
Copy link
Contributor

动机

ref:ant-design/ant-design#45416 (comment)

问题背景

ref:ant-design/ant-design#45416 (comment)

解决方案

修改 rc-picker 默认格式化优先使用 locale 中的 format:

  • weekFormat
  • monthFormat
  • quarterFormat
  • yearFormat
  • dateTimeFormat
  • dateFormat

从问题背景可以得知,这原本应该属于 antd3 的 feature,但是在升级为 4 的时候丢失了这个功能,导致开发者无法通过 CP 组件全局设置 antd 组件的格式化。该 PR 修复问题时,不得不改变原有的 src/locale/en_US.ts 文件来满足当前的测试用例。为了尽可能缩小影响范围,但是可能还是存在 BreakChange,仅管 antd4 已经没有用到 locale 中的 format,但如果有开发者二次开发引用到了 locale 文件,这无法避免破坏性变动了。以上

chore: add test

chore: update test

feat: add type

feat: update logic

chore: update snap

chore: update case

chore: update case

chore: remove note
(cherry picked from commit 01a27a5)

# Conflicts:
#	src/RangePicker.tsx
#	tests/picker.spec.tsx
@vercel
Copy link

vercel bot commented Oct 23, 2023

@Wxh16144 is attempting to deploy a commit to the React Component Team on Vercel.

A member of the Team first needs to authorize it.

@codecov
Copy link

codecov bot commented Oct 23, 2023

Codecov Report

Merging #688 (9300e60) into 2.7.x (fd5fe22) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head 9300e60 differs from pull request most recent head 80cc26d. Consider uploading reports for the commit 80cc26d to get more accurate results

@@            Coverage Diff             @@
##            2.7.x     #688      +/-   ##
==========================================
- Coverage   99.09%   99.09%   -0.01%     
==========================================
  Files          47       47              
  Lines        2215     2208       -7     
  Branches      675      680       +5     
==========================================
- Hits         2195     2188       -7     
  Misses         18       18              
  Partials        2        2              
Files Coverage Δ
src/Picker.tsx 100.00% <100.00%> (ø)
src/RangePicker.tsx 98.11% <100.00%> (ø)
src/utils/uiUtil.ts 99.18% <100.00%> (-0.05%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Wxh16144
Copy link
Contributor Author

outdated 😢

@Wxh16144 Wxh16144 closed this May 20, 2024
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.

None yet

1 participant