diff --git a/django/contrib/admin/media/js/calendar.js b/django/contrib/admin/media/js/calendar.js index 9804339e1d..c95a95db1b 100644 --- a/django/contrib/admin/media/js/calendar.js +++ b/django/contrib/admin/media/js/calendar.js @@ -46,6 +46,12 @@ var CalendarNamespace = { return days; }, draw: function(month, year, div_id, callback) { // month = 1-12, year = 1-9999 + var today = new Date(); + var todayDay = today.getDate(); + var todayMonth = today.getMonth()+1; + var todayYear = today.getFullYear(); + var todayClass = ''; + month = parseInt(month); year = parseInt(year); var calDiv = document.getElementById(div_id); @@ -76,7 +82,13 @@ var CalendarNamespace = { if (i%7 == 0 && currentDay != 1) { tableRow = quickElement('tr', tableBody); } - var cell = quickElement('td', tableRow, ''); + if ((currentDay==todayDay) && (month==todayMonth) && (year==todayYear)) { + todayClass='today'; + } else { + todayClass=''; + } + var cell = quickElement('td', tableRow, '', 'class', todayClass); + quickElement('a', cell, currentDay, 'href', 'javascript:void(' + callback + '('+year+','+month+','+currentDay+'));'); currentDay++; }