Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
25
No Weekends on DatePicker
posted

I have a subecription bu I cannot access the site with my other user name ben999.

Is it possible to remove weekends from the selection or disable them like in the jquery alternative.

Kind Regards


Matt

Parents
No Data
Reply
  • 25
    posted

    Fixed it, see below. Can you please fix my ben999 account.

    Thanks
    Ben


    <script type="text/javascript">
     
     function nonWorkingDates(date){
            var day = date.getDay(), Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6;
            var closedDates = [[7, 29, 2009], [8, 25, 2010]];
            var closedDays = [[Sunday], [Saturday]];
            for (var i = 0; i < closedDays.length; i++) {
                if (day == closedDays[i][0]) {
                    return [false];
                }

            }

            for (i = 0; i < closedDates.length; i++) {
                if (date.getMonth() == closedDates[i][0] - 1 &&
                date.getDate() == closedDates[i][1] &&
                date.getFullYear() == closedDates[i][2]) {
                    return [false];
                }
            }

            return [true];
        }

     $(function () {
     $('#picker).igDatePicker({
            width: 185,
       datepickerOptions: {
      beforeShowDay: nonWorkingDates
      }
     });
     });
     
    </script>

Children