jQuery-Timepicker-Addon icon indicating copy to clipboard operation
jQuery-Timepicker-Addon copied to clipboard

startdt.getTime not a function for timeRange

Open jmzbond opened this issue 9 years ago • 5 comments
trafficstars

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?

jmzbond avatar Mar 24 '16 00:03 jmzbond

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 [email protected] 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

[email protected]

trentrichardson.com

trentrichardson avatar Sep 14 '16 19:09 trentrichardson

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")

melbreaker avatar Feb 13 '18 09:02 melbreaker

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 avatar Feb 09 '19 19:02 semmelbroesel

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).

semmelbroesel avatar Feb 09 '19 19:02 semmelbroesel

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

saniyasaher20 avatar Apr 01 '21 08:04 saniyasaher20