mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 13:47:02 +08:00
4026221d45
* deps: upgrade TimePicker * deps: upgrade DatePicker * deps: upgrade Calendar * fix: moment should work with LocaleProvider * feat: update API of TimePicker * feat: update Calendar's APIs * feat: update DatePicker's APIs * doc: update demo * revert: add dateString and timeString and so on * feat: add Calendar[defaultValue] * feat: add defaultPickerValue * docs: update docs about date picker * feat: set moment locale to zh-cn automatically
32 lines
615 B
Markdown
32 lines
615 B
Markdown
---
|
|
order: 6
|
|
title:
|
|
zh-CN: 指定不可选择日期
|
|
en-US: Specify the date that cannot be selected
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
设置 `disabledDate` 方法,来确定不可选时段。
|
|
|
|
如上例:不可选择今天之后的日期。
|
|
|
|
## en-US
|
|
|
|
Specify unselectable period by `disabledDate`.
|
|
|
|
As in the example above: you can't select a date later than today.
|
|
|
|
````jsx
|
|
import { DatePicker } from 'antd';
|
|
|
|
const disabledDate = function (current) {
|
|
// can not select days after today
|
|
return current && current.valueOf() > Date.now();
|
|
};
|
|
|
|
ReactDOM.render(
|
|
<DatePicker disabledDate={disabledDate} />
|
|
, mountNode);
|
|
````
|