: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
$.timepicker.datetimeRange = function (startTime, endTime, options) {
$.timepicker.handleRange('datetimepicker', startTime, endTime, options);
* Calls `datepicker` on the `startTime` and `endTime` elements, and configures them to
* enforce date range limits.
* @param {Element} startTime
* @param {Element} endTime
* @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
* a boolean value that can be used to reformat the input values to the `dateFormat`.
$.timepicker.dateRange = function (startTime, endTime, options) {
$.timepicker.handleRange('datepicker', startTime, endTime, options);
* Calls `method` on the `startTime` and `endTime` elements, and configures them to
* enforce date range limits.
* @param {string} method Can be used to specify the type of picker to be added
* @param {Element} startTime
* @param {Element} endTime
* @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
* a boolean value that can be used to reformat the input values to the `dateFormat`.
$.timepicker.handleRange = function (method, startTime, endTime, options) {
minInterval: 0, // min allowed interval in milliseconds
maxInterval: 0, // max allowed interval in milliseconds
start: {}, // options for start picker
end: {} // options for end picker
function checkDates(changed, other) {
var startdt = startTime[method]('getDate'),
enddt = endTime[method]('getDate'),
changeddt = changed[method]('getDate');
var minDate = new Date(startdt.getTime()),
maxDate = new Date(startdt.getTime());
minDate.setMilliseconds(minDate.getMilliseconds() + options.minInterval);
maxDate.setMilliseconds(maxDate.getMilliseconds() + options.maxInterval);
if (options.minInterval > 0 && minDate > enddt) { // minInterval check
endTime[method]('setDate', minDate);
else if (options.maxInterval > 0 && maxDate < enddt) { // max interval check
endTime[method]('setDate', maxDate);
else if (startdt > enddt) {
other[method]('setDate', changeddt);
function selected(changed, other, option) {
var date = changed[method].call(changed, 'getDate');
if (date !== null && options.minInterval > 0) {
if (option === 'minDate') {
date.setMilliseconds(date.getMilliseconds() + options.minInterval);
if (option === 'maxDate') {
date.setMilliseconds(date.getMilliseconds() - options.minInterval);
other[method].call(other, 'option', option, date);
$.fn[method].call(startTime, $.extend({
onClose: function (dateText, inst) {
checkDates($(this), endTime);
onSelect: function (selectedDateTime) {
selected($(this), endTime, 'minDate');
}, options, options.start));
$.fn[method].call(endTime, $.extend({
onClose: function (dateText, inst) {
checkDates($(this), startTime);
onSelect: function (selectedDateTime) {
selected($(this), startTime, 'maxDate');
}, options, options.end));
checkDates(startTime, endTime);
selected(startTime, endTime, 'minDate');
selected(endTime, startTime, 'maxDate');
return $([startTime.get(0), endTime.get(0)]);
* Log error or data to the console during error or debugging
* @param {Object} err pass any type object to log to the console during error or debugging
$.timepicker.log = function (err) {
* Add util object to allow access to private methods for testability.
_extendRemove: extendRemove,
_isEmptyObject: isEmptyObject,
_convert24to12: convert24to12,
_detectSupport: detectSupport,
_selectLocalTimezone: selectLocalTimezone,
_computeEffectiveSetting: computeEffectiveSetting,
_splitDateTime: splitDateTime,
_parseDateTimeInternal: parseDateTimeInternal
if (!Date.prototype.getMicroseconds) {
Date.prototype.microseconds = 0;
Date.prototype.getMicroseconds = function () { return this.microseconds; };
Date.prototype.setMicroseconds = function (m) {
this.setMilliseconds(this.getMilliseconds() + Math.floor(m / 1000));
this.microseconds = m % 1000;
* Keep up with the version
$.timepicker.version = "1.4.3";