ant-design/components/datepicker/demo/range.md

23 lines
453 B
Markdown
Raw Normal View History

2015-05-27 20:41:16 +08:00
# 范围
2015-10-21 16:27:48 +08:00
- order: 6
2015-06-02 17:20:02 +08:00
2015-07-08 14:55:05 +08:00
设置 `disabledDate` 方法,来确定不可选时段。
2015-06-02 17:20:02 +08:00
2015-06-17 17:25:12 +08:00
如上例:不可选择今天之后的日期。
2015-05-27 20:41:16 +08:00
---
````jsx
import { Datepicker } from 'antd';
const disabledDate = function(current, value) {
2015-05-29 15:06:45 +08:00
// can not select days after today
2015-11-03 13:50:36 +08:00
return current && current.getTime() > Date.now();
2015-05-29 15:06:45 +08:00
};
2015-05-27 20:41:16 +08:00
2015-10-20 16:47:55 +08:00
ReactDOM.render(
2015-07-08 14:55:05 +08:00
<Datepicker disabledDate={disabledDate} />
2015-05-27 20:41:16 +08:00
, document.getElementById('components-datepicker-demo-range'));
````