diff --git a/components/datepicker/demo/start-end.md b/components/datepicker/demo/start-end.md index f6dfbeadd2..111e8f5b3a 100644 --- a/components/datepicker/demo/start-end.md +++ b/components/datepicker/demo/start-end.md @@ -9,53 +9,45 @@ ````jsx var Datepicker = antd.Datepicker; -var Test = React.createClass({ +var DateRange = React.createClass({ getInitialState() { return { startValue: null, endValue: null }; }, - - disabledEndDate(endValue) { - if (!endValue || !this.state.startValue) { - return false; - } - return endValue.getTime() <= this.state.startValue.getTime(); - }, - disabledStartDate(startValue) { if (!startValue || !this.state.endValue) { return false; } return startValue.getTime() >= this.state.endValue.getTime(); }, - + disabledEndDate(endValue) { + if (!endValue || !this.state.startValue) { + return false; + } + return endValue.getTime() <= this.state.startValue.getTime(); + }, onChange(field, value) { this.setState({ [field]: value, }); }, - render() { - var state = this.state; - return
- 开始时间:
-
- 结束时间:
-