Ticket #3014: time_with_seconds.diff

File time_with_seconds.diff, 3.6 KB (added by Esdras Beleza <linux@…>, 18 years ago)

update time field's seconds too.

  • django/contrib/admin/media/js/core.js

     
    119119    return (this.getMinutes() < 10) ? '0' + this.getMinutes() : this.getMinutes();
    120120}
    121121
     122Date.prototype.getTwoDigitSecond = function() {
     123    return (this.getSeconds() < 10) ? '0' + this.getSeconds() : this.getSeconds();
     124}
     125
    122126Date.prototype.getISODate = function() {
    123127    return this.getCorrectYear() + '-' + this.getTwoDigitMonth() + '-' + this.getTwoDigitDate();
    124128}
     
    127131    return this.getTwoDigitHour() + ':' + this.getTwoDigitMinute();
    128132}
    129133
     134Date.prototype.getHourMinuteSecond = function() {
     135    return this.getTwoDigitHour() + ':' + this.getTwoDigitMinute() + ':' + this.getTwoDigitSecond();
     136}
     137
    130138// ----------------------------------------------------------------------------
    131139// String object extensions
    132140// ----------------------------------------------------------------------------
  • django/contrib/admin/media/js/admin/DateTimeShortcuts.js

     
    4444        var shortcuts_span = document.createElement('span');
    4545        inp.parentNode.insertBefore(shortcuts_span, inp.nextSibling);
    4646        var now_link = document.createElement('a');
    47         now_link.setAttribute('href', "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", new Date().getHourMinute());");
     47        now_link.setAttribute('href', "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", new Date().getHourMinuteSecond());");
    4848        now_link.appendChild(document.createTextNode(gettext('Now')));
    4949        var clock_link = document.createElement('a');
    5050        clock_link.setAttribute('href', 'javascript:DateTimeShortcuts.openClock(' + num + ');');
     
    8080        quickElement('h2', clock_box, gettext('Choose a time'));
    8181        time_list = quickElement('ul', clock_box, '');
    8282        time_list.className = 'timelist';
    83         quickElement("a", quickElement("li", time_list, ""), gettext("Now"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", new Date().getHourMinute());")
    84         quickElement("a", quickElement("li", time_list, ""), gettext("Midnight"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '00:00');")
    85         quickElement("a", quickElement("li", time_list, ""), gettext("6 a.m."), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '06:00');")
    86         quickElement("a", quickElement("li", time_list, ""), gettext("Noon"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '12:00');")
     83        quickElement("a", quickElement("li", time_list, ""), gettext("Now"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", new Date().getHourMinuteSecond());")
     84        quickElement("a", quickElement("li", time_list, ""), gettext("Midnight"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '00:00:00');")
     85        quickElement("a", quickElement("li", time_list, ""), gettext("6 a.m."), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '06:00:00');")
     86        quickElement("a", quickElement("li", time_list, ""), gettext("Noon"), "href", "javascript:DateTimeShortcuts.handleClockQuicklink(" + num + ", '12:00:00');")
    8787
    8888        cancel_p = quickElement('p', clock_box, '');
    8989        cancel_p.className = 'calendar-cancel';
Back to Top