forked from misino/react-datepicker
-
Notifications
You must be signed in to change notification settings - Fork 4
/
MonthPicker.jsx
34 lines (28 loc) · 963 Bytes
/
MonthPicker.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/** @jsx React.DOM */
var React = require('react');
var monthNames = [
"Jan", "Feb", "Mar",
"Apr", "May", "Jun",
"Jul", "Aug", "Sep",
"Oct", "Nov", "Dec"];
var MonthPicker = React.createClass({
getDefaultProps: function() {
return {
buttonClassNames : "btn btn-xs btn-default",
textClassNames : "btn btn-xs"
};
},
changeMonth : function(month) {
this.props.onChangeMonth(month);
},
render: function() {
return (
<div className={"monthpicker"}>
<a onClick={this.changeMonth.bind(this, this.props.date.getMonth()-1)} className={this.props.buttonClassNames}><<</a>
<span className={this.props.textClassNames}>{monthNames[this.props.date.getMonth()] + ", " + this.props.date.getFullYear()}</span>
<a onClick={this.changeMonth.bind(this, this.props.date.getMonth()+1)} className={this.props.buttonClassNames}>>></a>
</div>
)
}
});
module.exports = MonthPicker;