5

だから私の質問はとても簡単です。このhttp://tokenposts.blogspot.fr/2011/05/jquery-datepicker-disable-specific.htmlのように、日付ピッカーで有効になっている特定の日付が必要ですが、月の最後の日だけが必要です、たとえば、2012 年 6 月 30 日、2012 年 7 月 31 日、...

どんな手掛かり ?

4

1 に答える 1

4

こうすればできる...

特定の年と月の最終日を取得する:

function getLastDayOfYearAndMonth(year, month)
{
    return(new Date((new Date(year, month + 1, 1)) - 1)).getDate();
}

beforeShowDay日付が先月の日付であるかどうかをイベントで確認します。

$('.selector').datepicker(
{
    beforeShowDay: function(date)
    {
        // getDate() returns the day [ 0 to 31 ]
        if (date.getDate() ==
            getLastDayOfYearAndMonth(date.getFullYear(), date.getMonth()))
        {
            return [true, ''];
        }

        return [false, ''];
    }
});
于 2012-07-04T13:53:44.010 に答える