Is there any way to highlight the current week starting from Monday to next Sunday ? Thanks in advance
A:
I don't know if this will help when doing it in drupal, but this is how it would be done with jQuery and the datepicker module. Days in the current week will be given the css class 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, ""];
}
});
});
Simen Echholt
2010-06-29 13:01:06