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

minTime / maxTime not applied when set repeatedly

Open xpavp03 opened this issue 10 years ago • 6 comments

Minimum hour will still be 15, even after the second call to minTime. Tested with the current dev version from Github.

<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-ui-timepicker-addon/1.4.5/jquery-ui-timepicker-addon.min.css">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<script src="jquery-ui-timepicker-addon.js"></script>
<!--script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-ui-timepicker-addon/1.4.5/jquery-ui-timepicker-addon.min.js"></script-->

<script type="text/javascript">
$(function() {
  $('#test').timepicker({
    stepMinute: 10,
    minuteGrid: 10,
    timeFormat: 'H:mm'
  });
  $('#test').timepicker('option', 'minTime', '15:00');
  $('#test').timepicker('option', 'minTime', '10:00');

});
</script>
</head>

<body>

<input id="test" name="test" value="">

</body>
</html>

No problem when using minDateTime:

  var dateObject = new Date(1970, 1, 1, 15, 00);
  $('#test').timepicker('option', 'minDateTime', dateObject);

  var dateObject = new Date(1970, 1, 1, 10, 00);
  $('#test').timepicker('option', 'minDateTime', dateObject);

xpavp03 avatar Jan 27 '15 17:01 xpavp03

same problem. how to set minTime?

andreas-stricker avatar Mar 15 '15 23:03 andreas-stricker

Same issue. Oh..

userlond avatar Apr 07 '15 06:04 userlond

Quick hack is to destroy and create datetimepicker on each option update.

userlond avatar Apr 07 '15 07:04 userlond

I can't set minTime or maxTime. I am using DateTimePicker with datepicker set to "false". Any help?

ixlipixli avatar Jan 21 '16 14:01 ixlipixli

How to destroy the timepicker and call it again ?

pnt9948 avatar Aug 17 '17 09:08 pnt9948

If I didn't forget something, it should work like this (example with datetimepicker):

// your input jQuery object
var cdt = $('input[name=DateTime]');
// create datetimepicker
cdt.datetimepicker({
    //your params
});
// destroy it
cdt.datetimepicker('destroy');
// create datetimepicker for a second time
cdt.datetimepicker({
    //your params
});

userlond avatar Aug 18 '17 04:08 userlond