jquery datetimepicker disable today -
i want allow selection of weekends excluding today (if today weekend). however, following code allows selection of today. trying:
jquery('.datetimepicker').datetimepicker({ timepicker:false, mindate:'+1970/01/01', maxdate:'+1970/01/10', defaultdate:'+1970/01/01', format:'d/m/y', beforeshowday: disableweekdays, closeondateselect: true }); function weekendsonly(date) { var day = date.getday(); return [(day > 0 && day < 6), '']; } function disableweekdays(date) { var weekenddate = weekendsonly(date); var disableweek = [!weekenddate[0]]; return disableweek; }
this using: http://xdsoft.net/jqplugins/datetimepicker/ also, mindate doesn't seem work @ all.
try - mindate = tomorrow.setdate(today.getdate() - 1);
var today = new date(); var tomorrow = new date(); tomorrow.setdate(today.getdate() - 1); $("#mindate").datepicker({ showon: "none", mindate: tomorrow, dateformat: "dd dd-mm-yy", onselect: function(datetext) { mindatechange; }, inputoffsetx: 5, });
let me know if works. haven't tried though. code might like:
var today = new date(); var tomorrow = new date(); today.setdate(today.getdate() - 1); jquery('.datetimepicker').datetimepicker({ timepicker:false, mindate:'+1970/01/01', maxdate:today, defaultdate:'+1970/01/01', format:'d/m/y', beforeshowday: disableweekdays, closeondateselect: true }); function weekendsonly(date) { var day = date.getday(); return [(day > 0 && day < 6), '']; } function disableweekdays(date) { var weekenddate = weekendsonly(date); var disableweek = [!weekenddate[0]]; return disableweek; }
Comments
Post a Comment