@@ -26,6 +26,7 @@ import getActiveElement from '../utils/getActiveElement';
2626import isDayVisible from '../utils/isDayVisible' ;
2727
2828import ScrollableOrientationShape from '../shapes/ScrollableOrientationShape' ;
29+ import DayOfWeekShape from '../shapes/DayOfWeekShape' ;
2930
3031import {
3132 HORIZONTAL_ORIENTATION ,
@@ -48,6 +49,7 @@ const propTypes = forbidExtraProps({
4849 onOutsideClick : PropTypes . func ,
4950 hidden : PropTypes . bool ,
5051 initialVisibleMonth : PropTypes . func ,
52+ firstDayOfWeek : DayOfWeekShape ,
5153 renderCalendarInfo : PropTypes . func ,
5254 hideKeyboardShortcutsPanel : PropTypes . bool ,
5355 daySize : nonNegativeInteger ,
@@ -90,6 +92,7 @@ export const defaultProps = {
9092 onOutsideClick ( ) { } ,
9193 hidden : false ,
9294 initialVisibleMonth : ( ) => moment ( ) ,
95+ firstDayOfWeek : null ,
9396 renderCalendarInfo : null ,
9497 hideKeyboardShortcutsPanel : false ,
9598 daySize : DAY_SIZE ,
@@ -682,11 +685,16 @@ export default class DayPicker extends React.Component {
682685 style = verticalStyle ;
683686 }
684687
688+ let { firstDayOfWeek } = this . props ;
689+ if ( firstDayOfWeek == null ) {
690+ firstDayOfWeek = moment . localeData ( ) . firstDayOfWeek ( ) ;
691+ }
692+
685693 const header = [ ] ;
686694 for ( let i = 0 ; i < 7 ; i += 1 ) {
687695 header . push (
688696 < li key = { i } style = { { width : daySize } } >
689- < small > { moment ( ) . weekday ( i ) . format ( 'dd' ) } </ small >
697+ < small > { moment ( ) . day ( ( i + firstDayOfWeek ) % 7 ) . format ( 'dd' ) } </ small >
690698 </ li > ,
691699 ) ;
692700 }
@@ -725,6 +733,7 @@ export default class DayPicker extends React.Component {
725733 onDayClick,
726734 onDayMouseEnter,
727735 onDayMouseLeave,
736+ firstDayOfWeek,
728737 renderMonth,
729738 renderDay,
730739 renderCalendarInfo,
@@ -842,6 +851,7 @@ export default class DayPicker extends React.Component {
842851 onMonthTransitionEnd = { this . updateStateAfterMonthTransition }
843852 monthFormat = { monthFormat }
844853 daySize = { daySize }
854+ firstDayOfWeek = { firstDayOfWeek }
845855 isFocused = { shouldFocusDate }
846856 focusedDate = { focusedDate }
847857 phrases = { phrases }
0 commit comments