trentrichardson / jQuery-Timepicker-Addon

Adds a timepicker to jQueryUI Datepicker
http://trentrichardson.com/examples/timepicker/
MIT License
2.66k stars 1.05k forks source link

startdt.getTime not a function for timeRange #872

Open jmzbond opened 8 years ago

jmzbond commented 8 years ago

Just downloaded latest JS (11/2015), plopped in exactly the example code as given:

var startTimeTextBox = $('#deliverytime_start');
var endTimeTextBox = $('#deliverytime_end');

$.timepicker.timeRange(
  startTimeTextBox,
  endTimeTextBox,
  {
    minInterval: (1000*60*60), // 1hr
    timeFormat: 'HH:mm',
    start: {}, // start picker options
    end: {} // end picker options
  }
);

Upon page load, getting this error: Uncaught TypeError: startdt.getTime is not a function

Has this happened to anyone else?

trentrichardson commented 8 years ago

Try the example as is in the documentation on the Examples tab, Time Ranges section, it is working there:

http://trentrichardson.com/examples/timepicker/

On Wed, Sep 14, 2016 at 2:58 PM, Angelo Riganis notifications@github.com wrote:

Same here...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/trentrichardson/jQuery-Timepicker-Addon/issues/872#issuecomment-247118621, or mute the thread https://github.com/notifications/unsubscribe-auth/AATHOAUhvPDJeH7mONpSppG1soxzvKu9ks5qqEPRgaJpZM4H3lur .

Thanks,

Trent Richardson

trentdrichardson@gmail.com

trentrichardson.com

melbreaker commented 6 years ago

This also happened to me. The workaround is to check if startdt.getTime function exist at checkDates function in jquery-ui-timepicker-addon.js.

if (startdt !== null && typeof startdt.getTime !== "undefined")

semmelbroesel commented 5 years ago

I have the same issue.

The workaround removes the error but also the functionality, so that is not a solution for me.

My code is virtually identical to that of the example page.

    var startBox = $dialog.find('timerangepickerstart').first();
    var endBox = $dialog.find('timerangepickerend').first();

    $.timepicker.timeRange(
        startBox,
        endBox,
        {
            minInterval: (1000*60*15),  // 15 minutes
            timeFormat: 'HH:mm',
            start: {},
            end: {}
        }
    );

I am running this on Bootstrap - would that make a difference?

Any ideas on how to fix this?

Thanks!

semmelbroesel commented 5 years ago

I figured it out - sorry, this was my fault. I thought "first()" would return just the first occurrence of the item in question, but apparently it returns much more that causes issues here.

As soon as I changed the startBox/endBox declaration to use ids instead of classes, it worked (using the workaround mentioned earlier).

saniyasaher20 commented 3 years ago

Just downloaded latest JS (11/2015), plopped in exactly the example code as given:

var startTimeTextBox = $('#deliverytime_start');
var endTimeTextBox = $('#deliverytime_end');

$.timepicker.timeRange(
  startTimeTextBox,
  endTimeTextBox,
  {
    minInterval: (1000*60*60), // 1hr
    timeFormat: 'HH:mm',
    start: {}, // start picker options
    end: {} // end picker options
  }
);

Upon page load, getting this error: Uncaught TypeError: startdt.getTime is not a function

Has this happened to anyone else?

I followed all steps written in docs but still date time range is not working. I am getting the same error in my console. Uncaught TypeError: startdt.getTime is not a function. Please help