4 Replies Latest reply on Mar 3, 2011 7:06 AM by dasago

    Unable to select the current date in calendar

    Vishwanath Bannur Newbie

      Hi,

       

      I have created calendar component with disabling the previous dates from current date. The code is as follows.

      Here i am not able to select the current date. How to disable only previous dates and enable to select other dates in a month including current date.

       

      Code:

       

      <style>

              .everyThirdDay{

                  background-color:gray;

                 

              }

              .weekendBold{

                  font-weight:bold;

                  font-style: italic;

              }

             

          </style>

          <script type="text/javascript">

              var curDt = new Date();

              function disablementFunction(day){

                  if (day.isWeekend) return false;

                  if (curDt==undefined){

                      curDt = day.date.getDate;

                  }

                  if (curDt.getTime() - day.date.getTime() &lt; 0) return true; else return false; 

              }

              function disabledClassesProv(day){

                  if (curDt.getTime() - day.date.getTime() &gt;= 0) return 'rich-calendar-boundary-dates';

                  var res = '';

                  if (day.isWeekend) res+='weekendBold ';

                  if (day.day%3==0) res+='everyThirdDay';

                  return res;

              }

          </script>

          <rich:calendar isDayEnabled="disablementFunction" dayStyleClass="disabledClassesProv" boundaryDatesMode="scroll"/>