diff --git a/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js b/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js
--- a/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js
+++ b/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js
@@ -247,15 +247,19 @@
         format = format.replace('\n', '\\n');
         format = format.replace('\t', '\\t');
         format = format.replace("'", "\\'");
-        return ["function(y, m, d) { DateTimeShortcuts.calendarInputs[",
-               num,
-               "].value = new Date(y, m-1, d).strftime('",
-               format,
-               "');DateTimeShortcuts.calendarInputs[",
-               num,
-               "].focus();document.getElementById(DateTimeShortcuts.calendarDivName1+",
-               num,
-               ").style.display='none';}"].join('');
+        return ["function(y, m, d) { selected = new Date(y, m-1, d);",
+                "DateTimeShortcuts.calendarInputs[",
+                num,
+                "].value = selected.strftime('",
+                format,
+                "');DateTimeShortcuts.calendarInputs[",
+                num,
+                "].focus();document.getElementById(DateTimeShortcuts.calendarDivName1+",
+                num,
+                ").style.display='none';",
+                "DateTimeShortcuts.calendars[",
+                num,
+                "].selected = selected;}"].join('');
     },
     handleCalendarQuickLink: function(num, offset) {
        var d = new Date();
diff --git a/django/contrib/admin/static/admin/js/calendar.js b/django/contrib/admin/static/admin/js/calendar.js
--- a/django/contrib/admin/static/admin/js/calendar.js
+++ b/django/contrib/admin/static/admin/js/calendar.js
@@ -46,30 +46,26 @@
         return days;
     },
     draw: function(month, year, div_id, callback, selected) { // 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 = '';
-        var is_selected_month = false; 
-        if (typeof selected != 'undefined') { 
-            is_selected_month = (selected.getFullYear() == year && (selected.getMonth()+1) == month); 
-        }
         month = parseInt(month);
         year = parseInt(year);
+        
         var calDiv = document.getElementById(div_id);
         removeChildren(calDiv);
         var calTable = document.createElement('table');
-        quickElement('caption', calTable, CalendarNamespace.monthsOfYear[month-1] + ' ' + year);
+        var caption = CalendarNamespace.monthsOfYear[month-1] + ' ' + year;
+        quickElement('caption', calTable, caption);
         var tableBody = quickElement('tbody', calTable);
 
         // Draw days-of-week header
         var tableRow = quickElement('tr', tableBody);
         for (var i = 0; i < 7; i++) {
-            quickElement('th', tableRow, CalendarNamespace.daysOfWeek[(i + CalendarNamespace.firstDayOfWeek) % 7]);
+            var dayNum = (i + CalendarNamespace.firstDayOfWeek) % 7
+            var dayName = CalendarNamespace.daysOfWeek[dayNum]
+            quickElement('th', tableRow, dayName);
         }
 
-        var startingPos = new Date(year, month-1, 1 - CalendarNamespace.firstDayOfWeek).getDay();
+        var startingPos = new Date(year, month-1, 
+                                   1-CalendarNamespace.firstDayOfWeek).getDay();
         var days = CalendarNamespace.getDaysInMonth(month, year);
 
         // Draw blanks before first of month
@@ -81,20 +77,32 @@
         }
 
         // Draw days of month
+        var is_selected_month = false; 
+        if (typeof selected != 'undefined') {
+            is_selected_month = (selected.getFullYear() == year && 
+                                 (selected.getMonth() + 1) == month); 
+        }
+        var today = new Date();
+        var todayDay = today.getDate();
+        var todayMonth = today.getMonth() + 1;
+        var todayYear = today.getFullYear();
         var currentDay = 1;
+        console.log(selected)
         for (var i = startingPos; currentDay <= days; i++) {
-            if (i%7 == 0 && currentDay != 1) {
+            if (i % 7 == 0 && currentDay != 1) {
                 tableRow = quickElement('tr', tableBody);
             }
-            todayClass='';
-            if ((currentDay==todayDay) && (month==todayMonth) && (year==todayYear)) {
-                todayClass='today';
+
+            var currentClass = '';
+            if ((currentDay == todayDay) && (month == todayMonth) && (year == todayYear)) {
+                currentClass = 'today';
             }
+
             if (is_selected_month && currentDay == selected.getDate()) { 
-                if (todayclass != '') todayclass += " "; 
-                todayclass += "selected"; /* e.g: class="today selected" */
+                if (currentClass != '') currentClass += " "; 
+                currentClass += "selected"; /* e.g: class="today selected" */
             } 
-            var cell = quickElement('td', tableRow, '', 'class', todayClass);
+            var cell = quickElement('td', tableRow, '', 'class', currentClass);
 
             quickElement('a', cell, currentDay, 'href', 'javascript:void(' + callback + '('+year+','+month+','+currentDay+'));');
             currentDay++;
@@ -123,12 +131,7 @@
     this.today = new Date();
     this.currentMonth = this.today.getMonth() + 1;
     this.currentYear = this.today.getFullYear();
-    if (typeof selected == 'undefined') { 
-            this.selected = this.today; 
-        } 
-        else { 
-            this.selected = selected; 
-        } 
+    this.selected = typeof selected == 'undefined' ? this.today : selected;
 }
 Calendar.prototype = {
     drawCurrent: function() {
