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: Calendar validRange prevents disabledDate #25626

Merged
merged 8 commits into from Jul 21, 2020

Conversation

zhangchen915
Copy link
Contributor

@zhangchen915 zhangchen915 commented Jul 14, 2020

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

close #25382
close #25633
close #25606

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English Fix Calendar validRange prevents disabledDate
Fix Calendar month select display
🇨🇳 Chinese 修复 Calendar 组件的 validRange 导致 disabledDate 不生效
修复 Calendar 组件 MonthSelect 月份下拉筛选

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@ant-design-bot
Copy link
Contributor

ant-design-bot commented Jul 14, 2020

@ant-design-bot
Copy link
Contributor

ant-design-bot commented Jul 14, 2020

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 14, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 982d9ce:

Sandbox Source
antd reproduction template Configuration
pensive-goldstine-2hwv7 Issue #25382
antd reproduction template Issue #25606

@zhangchen915
Copy link
Contributor Author

zhangchen915 commented Jul 15, 2020

CI 报错 react-intl 没安装?

: false;
return inRange || !!disabledDate?.(date);
},
[disabledDate, validRange],
Copy link
Member

@xrkffgg xrkffgg Jul 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你这个为啥会被格式化成这样,差点没看懂 😂😂

Copy link
Member

@zombieJ zombieJ Jul 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

提到外面来的话就直接用 useCallback 吧

Copy link
Contributor Author

@zhangchen915 zhangchen915 Jul 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@xrkffgg
Copy link
Member

xrkffgg commented Jul 15, 2020

changelog 填写一下,CI 先不用管

@xrkffgg
Copy link
Member

xrkffgg commented Jul 15, 2020

#25633
#25606

看下这几个,是不是一样的

@zhangchen915
Copy link
Contributor Author

zhangchen915 commented Jul 15, 2020

@xrkffgg 这两个是一个问题,这里 月份从零开始的 end 应该是 11

@xrkffgg
Copy link
Member

xrkffgg commented Jul 15, 2020

#25382
#25633
#25606

感觉这 3 个应该是有同一个问题,只是 #25382 以 disabledDate 表现出来,主要原因还是 validRange。

@zombieJ
Copy link
Member

zombieJ commented Jul 15, 2020

这个 issue 是说少了一个选项,这个变动看起来只是重构了 disabledDate 逻辑。没有修复 month select 少选项的问题

@zhangchen915
Copy link
Contributor Author

zhangchen915 commented Jul 15, 2020

这个修复的是 #25382 ,刚刚的提交修复了少选项的 #25633 #25606

@@ -110,7 +110,7 @@ function MonthSelect<DateType>(props: SharedProps<DateType>) {

const months = locale.shortMonths || generateConfig.locale.getShortMonths!(locale.locale);
const options: { label: string; value: number }[] = [];
for (let index = start; index < end; index += 1) {
for (let index = start; index <= end; index += 1) {
Copy link
Member

@zombieJ zombieJ Jul 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加个测试用例

Copy link
Contributor Author

@zhangchen915 zhangchen915 Jul 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@zombieJ zombieJ merged commit 22fdd41 into ant-design:master Jul 21, 2020
20 checks passed
@07akioni 07akioni mentioned this pull request Jul 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants