877-GRID-666 24/7 online support 604, Tower A, New Trade Plaza, N.T., Hong Kong

Set Start Day of the Week in Datepicker

Sunday was named as the first day in Jewish and early Christian tradition. However, Sunday is not always the first day of the week. In fact, some years ago, the International Organization for Standardization specified Monday as the first day. North American continue to follow Sunday as the first day of the week, while Europeans consider Monday the first day. Believe it or not, some countries have Saturday as the first day and some have no weeks (e.g. Africa)! Just see the start day of the week map below.

 

start-day-week

 

OK, enough of history. How do we actually go about changing the start day in our datepicker? Fear not, it is easier than you think. Just copy and paste the following event handling code in your phpGrid. It will change the default start day of the week from Sunday to Monday.

 
1
2
3
4
5
6
7
// change week start day to Monday
$weekStartDay = <<<DATEPICKWEEKSTARTDAY
function(){
    $('.hasDatepicker').datepicker('option', 'firstDay', 1)
}
DATEPICKWEEKSTARTDAY
;
$dg->add_event("jqGridAddEditAfterShowForm", $weekStartDay);

See Live Demo!