diff --git a/js/datetimepicker.js b/js/datetimepicker.js index 8854068..ec186c5 100644 --- a/js/datetimepicker.js +++ b/js/datetimepicker.js @@ -9,7 +9,8 @@ locale: 'en', positionShift: { top: 20, left: 0}, title: "Select Date and Time", - buttonTitle: "Select" + buttonTitle: "Select", + allowBackwards: false }, options); moment.locale(settings.locale); var elem = this; @@ -17,7 +18,7 @@ var mousedown = false; var timeout = 800; var selectDate = settings.selectData == "now" ? moment() : moment(settings.selectData, settings.dateFormat); - if (selectDate < moment()) { + if (selectDate < moment() && settings.allowBackwards == false) { selectDate = moment(); } var startDate = copyDate(moment()); @@ -107,7 +108,12 @@ var day = parseInt(m.format('D')); $b.text(day); if (flagStart && day < dayNow) { - $b.addClass('dtp_modal-grey'); + if (! (settings.allowBackwards)) { + $b.addClass('dtp_modal-grey'); + } else { + $b.addClass('cursorily'); + $b.bind('click', changeDate); + } } else if (flagSelect && day == cerDay) { $b.addClass('dtp_modal-cell-selected'); @@ -177,7 +183,7 @@ } function prevMonth() { - if (totalMonths(selectDate) > totalMonths(startDate)) { + if (totalMonths(selectDate) > totalMonths(startDate) || settings.allowBackwards == true) { selectDate.add(-1, 'month'); feelDates(selectDate); } @@ -385,4 +391,4 @@ } }(jQuery)); -// fa-caret-down \ No newline at end of file +// fa-caret-down