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

22 lines
448 B
Markdown
Raw Normal View History

2015-05-27 20:41:16 +08:00
# 范围
- order: 3
2015-06-02 17:20:02 +08:00
2015-06-17 17:18:15 +08:00
设置可选日期的范围,用 `disabled` 方法来定义不可选择时间。
2015-06-02 17:20:02 +08:00
比如不可选择今天之后的日期。
2015-05-27 20:41:16 +08:00
---
````jsx
2015-06-09 14:50:55 +08:00
var Datepicker = antd.Datepicker;
2015-05-29 15:06:45 +08:00
var disabledDate = function(current, value) {
// can not select days after today
return current.getTime() > Date.now();
};
2015-05-27 20:41:16 +08:00
React.render(
2015-05-29 15:06:45 +08:00
<Datepicker disabled={disabledDate} />
2015-05-27 20:41:16 +08:00
, document.getElementById('components-datepicker-demo-range'));
````