picker icon indicating copy to clipboard operation
picker copied to clipboard

fix: locale format not working error

Open Wxh16144 opened this issue 2 years ago • 2 comments

动机

ref:https://github.com/ant-design/ant-design/issues/45416#issuecomment-1770304575

问题背景

ref:https://github.com/ant-design/ant-design/issues/45416#issuecomment-1770289687

解决方案

修改 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 文件,这无法避免破坏性变动了。以上

Wxh16144 avatar Oct 23 '23 03:10 Wxh16144

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

A member of the Team first needs to authorize it.

vercel[bot] avatar Oct 23 '23 03:10 vercel[bot]

Codecov Report

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

:exclamation: 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%) :arrow_down:

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

codecov[bot] avatar Oct 23 '23 03:10 codecov[bot]

outdated 😢

Wxh16144 avatar May 20 '24 09:05 Wxh16144