@@ -70,7 +70,7 @@ const Calendar = React.createClass({
7070 const year = this . props . displayDate . getFullYear ( ) ;
7171 const month = this . props . displayDate . getMonth ( ) ;
7272 const firstDay = new Date ( year , month , 1 ) ;
73- const startingDay = this . props . weekStartsOnMonday ? ( firstDay . getDay ( ) + 1 ) : firstDay . getDay ( ) ;
73+ const startingDay = this . props . weekStartsOnMonday ? ( firstDay . getDay ( ) - 1 ) : firstDay . getDay ( ) ;
7474 let monthLength = daysInMonth [ month ] ;
7575 if ( month == 1 ) {
7676 if ( ( year % 4 == 0 && year % 100 != 0 ) || year % 400 == 0 ) {
@@ -142,10 +142,9 @@ export default React.createClass({
142142 getDefaultProps ( ) {
143143 const language = typeof window !== "undefined" && window . navigator ? ( window . navigator . userLanguage || window . navigator . language || '' ) . toLowerCase ( ) : '' ;
144144 const dateFormat = ! language || language === "en-us" ? 'MM/DD/YYYY' : 'DD/MM/YYYY' ;
145- const dayLabels = this . props . weekStartsOnMonday ? [ 'Mon' , 'Tue' , 'Wed' , 'Thu' , 'Fri' , 'Sat' , 'Sun' ] : [ 'Sun' , 'Mon' , 'Tue' , 'Wed' , 'Thu' , 'Fri' , 'Sat' ] ;
146145 return {
147146 cellPadding : "5px" ,
148- dayLabels,
147+ dayLabels : [ 'Sun' , 'Mon' , 'Tue' , 'Wed' , 'Thu' , 'Fri' , 'Sat' ] ,
149148 monthLabels : [ 'January' , 'February' , 'March' , 'April' ,
150149 'May' , 'June' , 'July' , 'August' , 'September' ,
151150 'October' , 'November' , 'December' ] ,
@@ -158,6 +157,11 @@ export default React.createClass({
158157 } ,
159158 getInitialState ( ) {
160159 var state = this . makeDateValues ( this . props . value ) ;
160+ if ( this . props . weekStartsOnMonday ) {
161+ state . dayLabels = this . props . dayLabels . slice ( 1 ) . concat ( this . props . dayLabels . slice ( 0 , 1 ) )
162+ } else {
163+ state . dayLabels = this . props . dayLabels ;
164+ }
161165 state . focused = false ;
162166 state . inputFocused = false ;
163167 state . placeholder = this . props . placeholder || this . props . dateFormat ;
@@ -382,7 +386,7 @@ export default React.createClass({
382386 return < InputGroup ref = "inputGroup" bsClass = { this . props . bsClass } bsSize = { this . props . bsSize } id = { this . props . id ? this . props . id + "_group" : null } >
383387 < Overlay rootClose = { true } onHide = { this . handleHide } show = { this . state . focused } container = { ( ) => ReactDOM . findDOMNode ( this . refs . overlayContainer ) } target = { ( ) => ReactDOM . findDOMNode ( this . refs . input ) } placement = { this . props . calendarPlacement } delayHide = { 200 } >
384388 < Popover id = "calendar" title = { calendarHeader } >
385- < Calendar cellPadding = { this . props . cellPadding } selectedDate = { this . state . selectedDate } displayDate = { this . state . displayDate } onChange = { this . onChangeDate } dayLabels = { this . props . dayLabels } weekStartsOnMonday = { this . props . weekStartsOnMonday } />
389+ < Calendar cellPadding = { this . props . cellPadding } selectedDate = { this . state . selectedDate } displayDate = { this . state . displayDate } onChange = { this . onChangeDate } dayLabels = { this . state . dayLabels } weekStartsOnMonday = { this . props . weekStartsOnMonday } />
386390 </ Popover >
387391 </ Overlay >
388392 < div ref = "overlayContainer" />
0 commit comments