fix: locale format not working error #688
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
动机
ref:ant-design/ant-design#45416 (comment)
问题背景
ref:ant-design/ant-design#45416 (comment)
解决方案
修改 rc-picker 默认格式化优先使用 locale 中的 format:
从问题背景可以得知,这原本应该属于 antd3 的 feature,但是在升级为 4 的时候丢失了这个功能,导致开发者无法通过 CP 组件全局设置 antd 组件的格式化。该 PR 修复问题时,不得不改变原有的
src/locale/en_US.ts
文件来满足当前的测试用例。为了尽可能缩小影响范围,但是可能还是存在 BreakChange,仅管 antd4 已经没有用到 locale 中的 format,但如果有开发者二次开发引用到了 locale 文件,这无法避免破坏性变动了。以上