@@ -12,25 +12,7 @@ var _reactDom = require('react-dom');
1212
1313var _reactDom2 = _interopRequireDefault ( _reactDom ) ;
1414
15- var _FormControl = require ( 'react-bootstrap/lib/FormControl' ) ;
16-
17- var _FormControl2 = _interopRequireDefault ( _FormControl ) ;
18-
19- var _InputGroup = require ( 'react-bootstrap/lib/InputGroup' ) ;
20-
21- var _InputGroup2 = _interopRequireDefault ( _InputGroup ) ;
22-
23- var _Popover = require ( 'react-bootstrap/lib/Popover' ) ;
24-
25- var _Popover2 = _interopRequireDefault ( _Popover ) ;
26-
27- var _Button = require ( 'react-bootstrap/lib/Button' ) ;
28-
29- var _Button2 = _interopRequireDefault ( _Button ) ;
30-
31- var _Overlay = require ( 'react-bootstrap/lib/Overlay' ) ;
32-
33- var _Overlay2 = _interopRequireDefault ( _Overlay ) ;
15+ var _reactBootstrap = require ( 'react-bootstrap' ) ;
3416
3517function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
3618
@@ -87,7 +69,8 @@ var Calendar = _react2.default.createClass({
8769 displayDate : _react2 . default . PropTypes . object . isRequired ,
8870 onChange : _react2 . default . PropTypes . func . isRequired ,
8971 dayLabels : _react2 . default . PropTypes . array . isRequired ,
90- cellPadding : _react2 . default . PropTypes . string . isRequired
72+ cellPadding : _react2 . default . PropTypes . string . isRequired ,
73+ weekStartsOnMonday : _react2 . default . PropTypes . bool
9174 } ,
9275 handleClick : function handleClick ( day ) {
9376 var newSelectedDate = new Date ( this . props . displayDate ) ;
@@ -111,7 +94,7 @@ var Calendar = _react2.default.createClass({
11194 var year = this . props . displayDate . getFullYear ( ) ;
11295 var month = this . props . displayDate . getMonth ( ) ;
11396 var firstDay = new Date ( year , month , 1 ) ;
114- var startingDay = firstDay . getDay ( ) ;
97+ var startingDay = this . props . weekStartsOnMonday ? firstDay . getDay ( ) - 1 : firstDay . getDay ( ) ;
11598 var monthLength = daysInMonth [ month ] ;
11699 if ( month == 1 ) {
117100 if ( year % 4 == 0 && year % 100 != 0 || year % 400 == 0 ) {
@@ -186,6 +169,7 @@ exports.default = _react2.default.createClass({
186169 monthLabels : _react2 . default . PropTypes . array ,
187170 onChange : _react2 . default . PropTypes . func ,
188171 onClear : _react2 . default . PropTypes . func ,
172+ weekStartsOnMonday : _react2 . default . PropTypes . bool ,
189173 clearButtonElement : _react2 . default . PropTypes . oneOfType ( [ _react2 . default . PropTypes . string , _react2 . default . PropTypes . object ] ) ,
190174 previousButtonElement : _react2 . default . PropTypes . oneOfType ( [ _react2 . default . PropTypes . string , _react2 . default . PropTypes . object ] ) ,
191175 nextButtonElement : _react2 . default . PropTypes . oneOfType ( [ _react2 . default . PropTypes . string , _react2 . default . PropTypes . object ] ) ,
@@ -208,6 +192,11 @@ exports.default = _react2.default.createClass({
208192 } ,
209193 getInitialState : function getInitialState ( ) {
210194 var state = this . makeDateValues ( this . props . value ) ;
195+ if ( this . props . weekStartsOnMonday ) {
196+ state . dayLabels = this . props . dayLabels . slice ( 1 ) . concat ( this . props . dayLabels . slice ( 0 , 1 ) ) ;
197+ } else {
198+ state . dayLabels = this . props . dayLabels ;
199+ }
211200 state . focused = false ;
212201 state . inputFocused = false ;
213202 state . placeholder = this . props . placeholder || this . props . dateFormat ;
@@ -433,24 +422,24 @@ exports.default = _react2.default.createClass({
433422 monthLabels : this . props . monthLabels ,
434423 dateFormat : this . props . dateFormat } ) ;
435424 return _react2 . default . createElement (
436- _InputGroup2 . default ,
425+ _reactBootstrap . InputGroup ,
437426 { ref : 'inputGroup' , bsClass : this . props . bsClass , bsSize : this . props . bsSize , id : this . props . id ? this . props . id + "_group" : null } ,
438427 _react2 . default . createElement (
439- _Overlay2 . default ,
428+ _reactBootstrap . Overlay ,
440429 { rootClose : true , onHide : this . handleHide , show : this . state . focused , container : function container ( ) {
441430 return _reactDom2 . default . findDOMNode ( _this2 . refs . overlayContainer ) ;
442431 } , target : function target ( ) {
443432 return _reactDom2 . default . findDOMNode ( _this2 . refs . input ) ;
444433 } , placement : this . props . calendarPlacement , delayHide : 200 } ,
445434 _react2 . default . createElement (
446- _Popover2 . default ,
435+ _reactBootstrap . Popover ,
447436 { id : 'calendar' , title : calendarHeader } ,
448- _react2 . default . createElement ( Calendar , { cellPadding : this . props . cellPadding , selectedDate : this . state . selectedDate , displayDate : this . state . displayDate , onChange : this . onChangeDate , dayLabels : this . props . dayLabels } )
437+ _react2 . default . createElement ( Calendar , { cellPadding : this . props . cellPadding , selectedDate : this . state . selectedDate , displayDate : this . state . displayDate , onChange : this . onChangeDate , dayLabels : this . state . dayLabels , weekStartsOnMonday : this . props . weekStartsOnMonday } )
449438 )
450439 ) ,
451440 _react2 . default . createElement ( 'div' , { ref : 'overlayContainer' } ) ,
452441 _react2 . default . createElement ( 'input' , { ref : 'hiddenInput' , type : 'hidden' , id : this . props . id , name : this . props . name , value : this . state . value || '' } ) ,
453- _react2 . default . createElement ( _FormControl2 . default , {
442+ _react2 . default . createElement ( _reactBootstrap . FormControl , {
454443 onKeyDown : this . handleKeyDown ,
455444 value : this . state . inputValue || '' ,
456445 ref : 'input' ,
@@ -461,7 +450,7 @@ exports.default = _react2.default.createClass({
461450 onChange : this . handleInputChange
462451 } ) ,
463452 _react2 . default . createElement (
464- _InputGroup2 . default . Addon ,
453+ _reactBootstrap . InputGroup . Addon ,
465454 { onClick : this . clear , style : { cursor : this . state . inputValue ? "pointer" : "not-allowed" } } ,
466455 this . props . clearButtonElement
467456 )
0 commit comments