0
有沒有什麼辦法突出從週一到下週日的本週?在date_popup中突出顯示當前的星期drupal
有沒有什麼辦法突出從週一到下週日的本週?在date_popup中突出顯示當前的星期drupal
我不知道這是否有助於在drupal中完成,但這是如何使用jQuery和datepicker模塊完成的。本週的日子將被授予css類highlight
。
$(function() {
var nowDate = new Date();
nowDate.setHours(0,0,0,0)
var nowTime = nowDate.getTime();
var dpFirstDay = 0; //what day is the first day of the week (0 = sunday, 1 = monday...)
$("#dp").datepicker({
firstDay: dpFirstDay,
beforeShowDay: function(date) {
var d = new Date(date);
d.setDate(d.getDate() - (((d.getDay() - dpFirstDay)%7)+7)%7);
for (var i = 0; i < 7; i++) {
if (d.getTime() == nowTime)
return [true, "highlight"];
d.setDate(d.getDate() + 1);
}
return [true, ""];
}
});
});