title: aui date picker, calendar with maximumDate attribute
body: <p>when I set aui datepicker with <strong>calendar maximumDate attribute</strong>, It was not getting selected properly sometimes (it's kind of weird though). Till noon it was working, later it was not.</p>
  
  <p>I am using Liferay 6.2 EE SP8. Using hook I am trying to change html\taglib\ui\input_date\page.jsp</p>
  
  <pre><code>&lt;%
  Calendar calendarCurrentDate = CalendarFactoryUtil.getCalendar();
  %&gt;
  &lt;%
                          if((PortalUtil.getPortletNamespace(PortletKeys.JOURNAL)).equals(namespace) &amp;&amp; name.equals("expirationDate")){                           
                      %&gt;
                      calendar: {
                          maximumDate: new Date(&lt;%= calendarCurrentDate.get(Calendar.YEAR)+1 %&gt;, &lt;%= calendarCurrentDate.get(Calendar.MONTH) %&gt;, &lt;%= calendarCurrentDate.get(Calendar.DAY_OF_MONTH) %&gt;)
                      },
                      &lt;%
                          }
                      %&gt;
  </code></pre>
  
  <p>Full datepicker code below</p>
  
  <pre><code>&lt;aui:script use='&lt;%= "aui-datepicker" + (BrowserSnifferUtil.isMobile(request) ? "-native" : StringPool.BLANK) %&gt;'&gt;
  Liferay.component(
      '&lt;%= nameId %&gt;DatePicker',
      function() {
          var datePicker = new A.DatePicker&lt;%= BrowserSnifferUtil.isMobile(request) ? "Native" : StringPool.BLANK %&gt;(
              {
                  container: '#&lt;%= randomNamespace %&gt;displayDate',
                  mask: '&lt;%= mask %&gt;',                    
                  &lt;%
                      if((PortalUtil.getPortletNamespace(PortletKeys.JOURNAL)).equals(namespace) &amp;&amp; name.equals("expirationDate")){                           
                  %&gt;
                  calendar: {
                      maximumDate: new Date(&lt;%= calendarCurrentDate.get(Calendar.YEAR)+1 %&gt;, &lt;%= calendarCurrentDate.get(Calendar.MONTH) %&gt;, &lt;%= calendarCurrentDate.get(Calendar.DAY_OF_MONTH) %&gt;)
                  },
                  &lt;%
                      }
                  %&gt;                  
                  on: {
                      disabledChange: function(event) {
                          var instance = this;
  
                          var container = instance.get('container');
  
                          var newVal = event.newVal;
                          console.log('disalbedChange'+newVal)
                          container.one('#&lt;%= dayParamId %&gt;').attr('disabled', newVal);
                          container.one('#&lt;%= monthParamId %&gt;').attr('disabled', newVal);
                          container.one('#&lt;%= nameId %&gt;').attr('disabled', newVal);
                          container.one('#&lt;%= yearParamId %&gt;').attr('disabled', newVal);
                      },
                      selectionChange: function(event) {
                          var instance = this;
  
                          var container = instance.get('container');
  
                          var date = event.newSelection[0];
                          console.log("event &gt;"+event);
                          console.log("date &gt;"+date);
                          if (date) {
                              container.one('#&lt;%= dayParamId %&gt;').val(date.getDate());
                              container.one('#&lt;%= monthParamId %&gt;').val(date.getMonth());
                              container.one('#&lt;%= yearParamId %&gt;').val(date.getFullYear());
                          }
                      }
                  },
                  popover: {
                      zIndex: Liferay.zIndex.TOOLTIP
                  },                  
                  trigger: '#&lt;%= nameId %&gt;'
              }
          );
  
          datePicker.getDate = function() {
              var instance = this;
  
              var container = instance.get('container');
  
              return new Date(container.one('#&lt;%= yearParamId %&gt;').val(), container.one('#&lt;%= monthParamId %&gt;').val(), container.one('#&lt;%= dayParamId %&gt;').val());
          };
  
          return datePicker;
      }
  );
  
  Liferay.component('&lt;%= nameId %&gt;DatePicker');
  </code></pre>
  
  <p></p>
  
  <p>Any help much appreciated. Is it anything related to timezone.</p>
  
  <p><strong>Try to select max date as date, next when you click in input box - input value becomes blank. This will not be the case if we select other dates prior to max date. Max date is one year from current date</strong></p>
  
  <p>JS fiddle</p>
  
  <p><a href="http://jsfiddle.net/uasvug1h/1/" rel="nofollow">http://jsfiddle.net/uasvug1h/1/</a>(alloy 3 it was working)</p>
  
  <p><a href="http://jsfiddle.net/btnkumar/uasvug1h/2/" rel="nofollow">http://jsfiddle.net/btnkumar/uasvug1h/2/</a>(alloy 2 it was not working)</p>
  
  <p>How to make this work in alloy 2</p>