From e7f38dc52af22fdd6a06fbee5779b6f61d66a4bf Mon Sep 17 00:00:00 2001 From: pete Date: Wed, 10 Dec 2014 11:44:12 -0500 Subject: [PATCH] Added minDateTime option for people who want to limit users to both a date and a time minimum. --- jquery.datetimepicker.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jquery.datetimepicker.js b/jquery.datetimepicker.js index b0d3de1..cc84b63 100644 --- a/jquery.datetimepicker.js +++ b/jquery.datetimepicker.js @@ -1402,9 +1402,11 @@ h = parseInt(now.getHours(), 10); now.setMinutes(m); m = parseInt(now.getMinutes(), 10); - + var optionDateTime = new Date(_xdsoft_datetime.currentTime) + optionDateTime.setHours(h); + optionDateTime.setMinutes(m); classes = []; - if ((options.maxTime !== false && _xdsoft_datetime.strtotime(options.maxTime).getTime() < now.getTime()) || (options.minTime !== false && _xdsoft_datetime.strtotime(options.minTime).getTime() > now.getTime())) { + if((options.minDateTime !== false && options.minDateTime > optionDateTime) || (options.maxTime !== false && _xdsoft_datetime.strtotime(options.maxTime).getTime() < now.getTime()) || (options.minTime !== false && _xdsoft_datetime.strtotime(options.minTime).getTime() > now.getTime())) { classes.push('xdsoft_disabled'); } if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && parseInt(_xdsoft_datetime.currentTime.getHours(), 10) === parseInt(h, 10) && (options.step > 59 || Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step === parseInt(m, 10))) {