|
|
|
@ -5,6 +5,7 @@ var DatePicker = Calendar.Picker;
|
|
|
|
|
var GregorianCalendar = require('gregorian-calendar');
|
|
|
|
|
var zhCn = require('gregorian-calendar/lib/locale/zh-cn');
|
|
|
|
|
var CalendarLocale = require('rc-calendar/lib/locale/zh-cn');
|
|
|
|
|
var DateTimeFormat = require('gregorian-calendar-format');
|
|
|
|
|
|
|
|
|
|
module.exports = React.createClass({
|
|
|
|
|
getInitialState: function () {
|
|
|
|
@ -16,8 +17,14 @@ module.exports = React.createClass({
|
|
|
|
|
value: value
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
getDefaultProps: function () {
|
|
|
|
|
return {
|
|
|
|
|
format: 'yyyy-MM-dd'
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
render: function () {
|
|
|
|
|
var state = this.state;
|
|
|
|
|
var formatter = new DateTimeFormat(this.props.format);
|
|
|
|
|
var calendar = (
|
|
|
|
|
<Calendar
|
|
|
|
|
locale={CalendarLocale}
|
|
|
|
@ -26,8 +33,7 @@ module.exports = React.createClass({
|
|
|
|
|
);
|
|
|
|
|
return (
|
|
|
|
|
<DatePicker
|
|
|
|
|
trigger={<span className="datepicker-icon" />}
|
|
|
|
|
formatter={this.props.formatter} calendar={calendar}
|
|
|
|
|
formatter={formatter} calendar={calendar}
|
|
|
|
|
value={this.state.value} onChange={this.handleChange}>
|
|
|
|
|
<input type="text" className="datepicker-input" />
|
|
|
|
|
</DatePicker>
|
|
|
|
|