diff options
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/calendar.js | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/www/js/calendar.js b/www/js/calendar.js index afc2369..5df77ac 100644 --- a/www/js/calendar.js +++ b/www/js/calendar.js @@ -28,9 +28,9 @@ function getLastMonday() { d.setUTCHours(12, 0, 0, 0); var dow = d.getUTCDay() if(dow == 0) { - return new Date(d - (6*24*3600000)); + return new Date(d.valueOf() - (6*24*3600000)); } else { - return new Date(d - ((dow-1)*24*3600000)); + return new Date(d.valueOf() - ((dow-1)*24*3600000)); } } @@ -38,9 +38,10 @@ function addDeltaDays(d, days) { return new Date(d.valueOf() + (days*24*3600000)) } -function isThisWeek(d) { - var lastmon = getLastMonday() - return ((d - lastmon) == 0) +function isToday(d) { + var today = new Date(clock.getRDTimeMS()); + today.setUTCHours(12, 0, 0, 0); + return ((d - today) == 0) } function addWeekClass(row, week) { @@ -72,15 +73,13 @@ function calendar_redraw(weekstart) { var week = get_rd_week(date.valueOf() + 7199999); var row = $('<tr>'); addWeekClass(row, week); - if(isThisWeek(date)) { - row.append($('<td>').addClass('currentweek').text('*')); - } else { - row.append($('<td>').addClass('currentweek').text('')); - } row.append($('<td>').addClass('week').text(week)); row.append($('<td>').addClass('month').text(monthname_short[date.getUTCMonth()] + ' ' + date.getUTCFullYear())); for(var d = 0; d < 7; d++) { var col = $('<td>').text(date.getUTCDate()); + if(isToday(date)) { + col.addClass('today'); + } row.append(col); if(d < 6) { date = addDeltaDays(date, 1); |