[Rt-commit] rt branch, 4.0/datetimepicker-ui, updated. rt-4.0.2-116-gc632e77

Alex Vandiver alexmv at bestpractical.com
Mon Jun 25 15:39:56 EDT 2012


The branch, 4.0/datetimepicker-ui has been updated
       via  c632e77025581f64a0aeeb2947d21afc64176979 (commit)
      from  1b2787b1bb87897eb1e93f817eb8581a1850ce8f (commit)

Summary of changes:
 share/html/NoAuth/js/jquery-ui-patch-datepicker.js |   13 +++++++++++++
 1 file changed, 13 insertions(+)

- Log -----------------------------------------------------------------
commit c632e77025581f64a0aeeb2947d21afc64176979
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jun 25 14:35:38 2012 -0400

    Patch timepicker to not assume all date selections have time selection
    
    The timepicker attempts to override the "Today" button in the usual
    datepicker to add a timestamp.  However, this fails with javascript
    errors ("Cannot read property '_defaults' of undefined") if the
    timepicker has not been instantiated on that element.
    
    Hotpatch over the timepicker's override of the datepicker's "Today"
    button, causing it to correctly revert to the standard datepicker's
    functionality if the timepicker is not enabled for that element.
    
    This is fixed in upstream in 3ac151f [1].  Once the timepicker is
    upgraded past that version, this hotfix is no longer necessary.
    
    [1] https://github.com/trentrichardson/jQuery-Timepicker-Addon/commit/3ac151f

diff --git a/share/html/NoAuth/js/jquery-ui-patch-datepicker.js b/share/html/NoAuth/js/jquery-ui-patch-datepicker.js
index c6497b2..10e84a9 100644
--- a/share/html/NoAuth/js/jquery-ui-patch-datepicker.js
+++ b/share/html/NoAuth/js/jquery-ui-patch-datepicker.js
@@ -78,6 +78,19 @@
         return offset;
     };
 
+    // Timepicker incorrectly assumes all datepickers have a timepicker
+    // on them when overriding the 'Today' button
+    $.datepicker._gotoToday_timepicker = $.datepicker._gotoToday;
+    $.datepicker._gotoToday = function(id) {
+        var inst = this._getInst($(id)[0]);
+        var $dp  = inst.dpDiv;
+        var tp_inst = this._get(inst, 'timepicker');
+        if (tp_inst)
+            return $.datepicker._gotoToday_timepicker(id);
+        $.datepicker._base_gotoToday(id);
+        $( '.ui-datepicker-today', $dp).click()
+    };
+
 
     $.timepicker._newInst_orig = $.timepicker._newInst;
     $.timepicker._newInst = function($input, o) {

-----------------------------------------------------------------------


More information about the Rt-commit mailing list