2015-05-21 20:36:13 +08:00
|
|
|
require('rc-calendar/assets/index.css');
|
|
|
|
var React = require('react');
|
|
|
|
var Calendar = require('rc-calendar');
|
|
|
|
var DatePicker = Calendar.Picker;
|
|
|
|
var GregorianCalendar = require('gregorian-calendar');
|
|
|
|
var zhCn = require('gregorian-calendar/lib/locale/zh-cn');
|
2015-05-22 12:02:56 +08:00
|
|
|
var CalendarLocale = require('rc-calendar/lib/locale/zh-cn');
|
2015-05-21 20:36:13 +08:00
|
|
|
|
|
|
|
module.exports = React.createClass({
|
|
|
|
getInitialState: function () {
|
|
|
|
var value = new GregorianCalendar(zhCn);
|
|
|
|
value.setTime(Date.now());
|
|
|
|
return {
|
|
|
|
time: Date.now(),
|
|
|
|
showTime: true,
|
|
|
|
value: value
|
|
|
|
};
|
|
|
|
},
|
|
|
|
render: function () {
|
|
|
|
var state = this.state;
|
|
|
|
var calendar = (
|
|
|
|
<Calendar
|
2015-05-22 12:02:56 +08:00
|
|
|
locale={CalendarLocale}
|
2015-05-21 20:36:13 +08:00
|
|
|
orient={['top', 'left']}
|
|
|
|
showTime={this.state.showTime} showClear={true} />
|
|
|
|
);
|
|
|
|
return (
|
|
|
|
<DatePicker
|
|
|
|
trigger={<span className="datepicker-icon" />}
|
|
|
|
formatter={this.props.formatter} calendar={calendar}
|
|
|
|
value={this.state.value} onChange={this.handleChange}>
|
|
|
|
<input type="text" className="datepicker-input" />
|
|
|
|
</DatePicker>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|