Search code examples
javascriptjquerydatepickerjquery-ui-datepickerjquery-ui-timepicker

Jquery UI timepicker add-on firing parsing error


I keep on get an error when using this the JQuery time picker add-on from here trentrichardson.com/examples/timepicker/ I don't know what's wrong with it and no matter what I do it doesn't change.

my code goes something like this

JavaScript

var queryDate new date(document.getElementById('tempcontainer').value);
$(function()){
    $("#tempcontainer").datetimepicker({
        timeFormat:"hh:mm:ss",
        dateFormat:"d M yy",
        defaultValue:queryDate, ... etc

HTML

<input id=tempcontainer name=fld-date-24 value="28 September 2013">

I'm getting an error like this:

Error parsing the date/time string: Unexpected literal at position 6
date/time string = 28 September 2013
timeFormat: hh:mm:ss
dateFormat: d M yy


Solution

  • Your date format is 'd M yy' which would have to be '28 Sep 2013', so when it hits the 't' in September it throws an error.

    Try 'd MM yy' instead.

    You can find details on all the datepicker format options at http://api.jqueryui.com/datepicker/.