diff --git a/components/datepicker/demo/basic.md b/components/datepicker/demo/basic.md index 068b24431d..b2d724cc6f 100644 --- a/components/datepicker/demo/basic.md +++ b/components/datepicker/demo/basic.md @@ -11,6 +11,6 @@ var Datepicker = antd.Datepicker; React.render( - + , document.getElementById('components-datepicker-demo-basic')); ```` diff --git a/components/datepicker/index.jsx b/components/datepicker/index.jsx index 49368b09fe..ee7dd02752 100644 --- a/components/datepicker/index.jsx +++ b/components/datepicker/index.jsx @@ -15,7 +15,6 @@ Locale.shortMonths = ['1月', '2月', '3月', '4月', '5月', '6月', let defaultCalendarValue = new GregorianCalendar(zhCn); defaultCalendarValue.setTime(Date.now()); - function createPicker(TheCalendar) { return React.createClass({ getInitialState() { @@ -73,6 +72,11 @@ function createPicker(TheCalendar) { } else if (this.props.size === 'small') { sizeClass = ' ant-input-sm'; } + let defaultValue; + if (this.props.defaultValue) { + defaultValue = new GregorianCalendar(zhCn); + defaultValue.setTime(new Date(this.props.defaultValue).valueOf()); + } return (