0

I am using the jQuery UI Datepicker. It is set to inline so it is displayed to the user all the time.

The datepicker allows you to select one day however I want to be able to select a week (of seven days)

So if the user clicks for example on Wednesday 2009/10/14 it should not only highlight the 2009/10/14 but highlight all days from 2009/10/14 to 2009/10/20.

How can I realize that?

4

2 に答える 2

0

これは古い投稿であることは知っていますが、同じ問題に遭遇したばかりで、リンクが壊れているため、解決策を投稿しています。

    $('#datepicker').datepicker({ 
    dateFormat: 'yy-mm-dd',
    defaultDate: '2011-05-10',
    changeMonth: true,
    changeYear: true,
    beforeShowDay: function(date){
        var selectedDate = new Date('2011-05-10');
        if (date.getFullYear() == selectedDate.getFullYear()
            && date.getMonthName() == selectedDate.getMonthName() 
            && date.getDate() >= selectedDate.getDate() 
            && date.getDate() <= selectedDate.addDays(6).getDate()
            ) {
            return [true, 'ui-datepicker-days-cell highlight', ""];
         }
        return [true, 'ui-datepicker-days-cell',""]
       }
    });
于 2011-03-22T15:49:46.777 に答える