Django

Code

Changeset 6214

Show
Ignore:
Timestamp:
09/14/07 16:04:45 (1 year ago)
Author:
jacob
Message:

Fixed #4448: the calendar widget now refreshes if the date field is changed. THanks, gkelly.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/admin/media/js/admin/DateTimeShortcuts.js

    r4087 r6214  
    196196        var cal_box = document.getElementById(DateTimeShortcuts.calendarDivName1+num) 
    197197        var cal_link = document.getElementById(DateTimeShortcuts.calendarLinkName+num) 
     198        var inp = DateTimeShortcuts.calendarInputs[num]; 
     199 
     200        // Determine if the current value in the input has a valid date. 
     201        // If so, draw the calendar with that date's year and month. 
     202        if (inp.value) { 
     203            var date_parts = inp.value.split('-'); 
     204            var year = date_parts[0]; 
     205            var month = parseFloat(date_parts[1]); 
     206            if (year.match(/\d\d\d\d/) && month >= 1 && month <= 12) { 
     207                DateTimeShortcuts.calendars[num].drawDate(month, year); 
     208            } 
     209        } 
     210 
    198211     
    199212        // Recalculate the clockbox position