2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 6
|
2016-06-19 11:17:09 +08:00
|
|
|
title:
|
|
|
|
zh-CN: 指定不可选择日期
|
|
|
|
en-US: Specify the date that cannot be selected
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-12-25 01:21:03 +08:00
|
|
|
|
2016-06-19 11:17:09 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2015-12-25 01:21:03 +08:00
|
|
|
设置 `disabledDate` 方法,来确定不可选时段。
|
|
|
|
|
|
|
|
如上例:不可选择今天之后的日期。
|
|
|
|
|
2016-06-19 11:17:09 +08:00
|
|
|
## en-US
|
|
|
|
|
|
|
|
Specify unselectable period by `disabledDate`.
|
|
|
|
|
|
|
|
As in the example above: you can't select a date later than today.
|
|
|
|
|
2015-12-25 01:21:03 +08:00
|
|
|
````jsx
|
|
|
|
import { DatePicker } from 'antd';
|
|
|
|
|
2016-01-27 16:53:05 +08:00
|
|
|
const disabledDate = function (current) {
|
2015-12-25 01:21:03 +08:00
|
|
|
// can not select days after today
|
|
|
|
return current && current.getTime() > Date.now();
|
|
|
|
};
|
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
<DatePicker disabledDate={disabledDate} />
|
2015-12-29 12:08:58 +08:00
|
|
|
, mountNode);
|
2015-12-25 01:21:03 +08:00
|
|
|
````
|