@@ -70,7 +70,7 @@ const Calendar = React.createClass({
70
70
const year = this . props . displayDate . getFullYear ( ) ;
71
71
const month = this . props . displayDate . getMonth ( ) ;
72
72
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 ( ) ;
74
74
let monthLength = daysInMonth [ month ] ;
75
75
if ( month == 1 ) {
76
76
if ( ( year % 4 == 0 && year % 100 != 0 ) || year % 400 == 0 ) {
@@ -142,10 +142,9 @@ export default React.createClass({
142
142
getDefaultProps ( ) {
143
143
const language = typeof window !== "undefined" && window . navigator ? ( window . navigator . userLanguage || window . navigator . language || '' ) . toLowerCase ( ) : '' ;
144
144
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' ] ;
146
145
return {
147
146
cellPadding : "5px" ,
148
- dayLabels,
147
+ dayLabels : [ 'Sun' , 'Mon' , 'Tue' , 'Wed' , 'Thu' , 'Fri' , 'Sat' ] ,
149
148
monthLabels : [ 'January' , 'February' , 'March' , 'April' ,
150
149
'May' , 'June' , 'July' , 'August' , 'September' ,
151
150
'October' , 'November' , 'December' ] ,
@@ -158,6 +157,11 @@ export default React.createClass({
158
157
} ,
159
158
getInitialState ( ) {
160
159
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
+ }
161
165
state . focused = false ;
162
166
state . inputFocused = false ;
163
167
state . placeholder = this . props . placeholder || this . props . dateFormat ;
@@ -382,7 +386,7 @@ export default React.createClass({
382
386
return < InputGroup ref = "inputGroup" bsClass = { this . props . bsClass } bsSize = { this . props . bsSize } id = { this . props . id ? this . props . id + "_group" : null } >
383
387
< 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 } >
384
388
< 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 } />
386
390
</ Popover >
387
391
</ Overlay >
388
392
< div ref = "overlayContainer" />
0 commit comments