Jquery UI Date Picker Restrict Date
I've got some existing code for a jquery ui date picker that needs to have a restriction on the current date. If a user is attempting to use the date picker to schedule service, they need to not be able to select the same day as the current day. I understand what I'm looking at here, but am a novice to say the least and don't want to break anything. Anyone have any suggestions on how to do this?
- var weekday = new Array(7);
-
- weekday[0] = "Sunday";
- weekday[1] = "Monday";
- weekday[2] = "Tuesday";
- weekday[3] = "Wednesday";
- weekday[4] = "Thursday";
- weekday[5] = "Friday";
- weekday[6] = "Saturday";
- var Globalday = 0;
- var nowDate = new Date();
- var today = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate(), 0, 0, 0, 0);
- $(function () {
- $("#00Ni000000EmYTY").datepicker(
- {
- minDate: 0,
- startDate: today,
- beforeShowDay: function (date) {
- var day = date.getDay();
- if ((date.getMonth() == 0) && (date.getDate() == 1)) {
- return '';
- }
- if ((date.getMonth() == 6) && (date.getDate() == 4)) {
- return '';
- }
- if ((date.getMonth() == 11) && (date.getDate() == 25)) {
- return '';
- }
-
- if ((date.getMonth() == 10) && (day == 4) && (Math.ceil(date.getDate() / 7)) >= 4) {
- return '';
- }
- return [day != 0, ''];
- },