Skip to content

Including timepicker breaks existing datepicker 'setDate' method. #64

@enderwiggum

Description

@enderwiggum

Problem: I have an existing datepicker usage. I include the timepicker JS and this line breaks:

$( "#eventdate" ).datepicker('setDate', 'today');

Looks like the '_setDateDatepicker' function on line 725 expects the argument to always be a date object; the datepicker docs say different (you can use words like 'Now', 'today', etc.).

Workaround: instead of string 'today', pass an empty Date object:

$( "#eventdate" ).datepicker('setDate', (new Date()));

The Error I got (from Opera 11.00 on WinXP 32-bit):

Uncaught exception: TypeError: 'date.getTime' is not a function


Error thrown at line 726, column 1 in (target, date) in http://leaflock.net/results/jquery-ui-timepicker-addon.js:
    var inst = this._getInst(target),
called from line 545, column 45 in () in http://leaflock.net/results/js/jquery-ui-1.8.7.custom.min.js:
    typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)
called via Function.prototype.apply() from line 33, column 27 in (j, s, v) in http://leaflock.net/results/jquery.js:
    for(v=j[0];H(j, s) in http://leaflock.net/results/jquery.js:
    return b.each(this,j,s)
called from line 545, column 0 in (a) in http://leaflock.net/results/js/jquery-ui-1.8.7.custom.min.js:
    return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})
called from line 18, column 3 in () in http://leaflock.net/results/mediation:
    $( "#eventdate" ).datepicker('setDate', 'today');
called from line 29, column 165 in (j) in http://leaflock.net/results/jquery.js:
    j.call(t,b);
called via Function.prototype.call() from line 37, column 7 in () in http://leaflock.net/results/jquery.js:
    b.ready()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions