2009-08-21 16 views

Odpowiedz

46

Spróbuj opcję firstDay (w zakładce opcje):

//getter 
var firstDay = $('.selector').datepicker('option', 'firstDay'); 
//setter 
$('.selector').datepicker('option', 'firstDay', 1); 
69

Oto przykład config używam. Spójrz na ostatni wiersz z "firstDay: 1". myślę użyciu sytax tak, aby określić opcje datepicker wygląda lepiej;)

$('#datepickerfield').datepicker({ 
    constrainInput: true, // prevent letters in the input field 
    minDate: new Date(), // prevent selection of date older than today 
    showOn: 'button',  // Show a button next to the text-field 
    autoSize: true,   // automatically resize the input field 
    altFormat: 'yy-mm-dd', // Date Format used 
    beforeShowDay: $.datepicker.noWeekends,  // Disable selection of weekends 
    firstDay: 1 // Start with Monday 
}) 
7

za korzystanie pierwszy dzień jako Poniedziałek:

$(function() { 
    $("#date_id").datepicker({ firstDay: 1 }); 
}); 
-2
function getFirstDateOfThisWeek(d) 
    { 
     var TempDate = new Date(d || new Date());    
     TempDate.setDate(TempDate.getDate() + (@Config.WeekStartOn - 1 - TempDate.getDay() - 7) % 7);   
     return TempDate; 

    } 

    var StartDate = getFirstDateOfThisWeek(new Date()); //1st date of this week 
Powiązane problemy