выбор даты aui, календарь с атрибутом maxDate

когда я установил aui datepicker с атрибутом maxDate календаря, иногда он не выбирался должным образом (хотя это немного странно). До полудня работало, потом нет.

Я использую Liferay 6.2 EE SP8. Используя ловушку, я пытаюсь изменить html\taglib\ui\input_date\page.jsp

<%
Calendar calendarCurrentDate = CalendarFactoryUtil.getCalendar();
%>
<%
                        if((PortalUtil.getPortletNamespace(PortletKeys.JOURNAL)).equals(namespace) && name.equals("expirationDate")){                           
                    %>
                    calendar: {
                        maximumDate: new Date(<%= calendarCurrentDate.get(Calendar.YEAR)+1 %>, <%= calendarCurrentDate.get(Calendar.MONTH) %>, <%= calendarCurrentDate.get(Calendar.DAY_OF_MONTH) %>)
                    },
                    <%
                        }
                    %>

Полный код средства выбора даты ниже

<aui:script use='<%= "aui-datepicker" + (BrowserSnifferUtil.isMobile(request) ? "-native" : StringPool.BLANK) %>'>
Liferay.component(
    '<%= nameId %>DatePicker',
    function() {
        var datePicker = new A.DatePicker<%= BrowserSnifferUtil.isMobile(request) ? "Native" : StringPool.BLANK %>(
            {
                container: '#<%= randomNamespace %>displayDate',
                mask: '<%= mask %>',                    
                <%
                    if((PortalUtil.getPortletNamespace(PortletKeys.JOURNAL)).equals(namespace) && name.equals("expirationDate")){                           
                %>
                calendar: {
                    maximumDate: new Date(<%= calendarCurrentDate.get(Calendar.YEAR)+1 %>, <%= calendarCurrentDate.get(Calendar.MONTH) %>, <%= calendarCurrentDate.get(Calendar.DAY_OF_MONTH) %>)
                },
                <%
                    }
                %>                  
                on: {
                    disabledChange: function(event) {
                        var instance = this;

                        var container = instance.get('container');

                        var newVal = event.newVal;
                        console.log('disalbedChange'+newVal)
                        container.one('#<%= dayParamId %>').attr('disabled', newVal);
                        container.one('#<%= monthParamId %>').attr('disabled', newVal);
                        container.one('#<%= nameId %>').attr('disabled', newVal);
                        container.one('#<%= yearParamId %>').attr('disabled', newVal);
                    },
                    selectionChange: function(event) {
                        var instance = this;

                        var container = instance.get('container');

                        var date = event.newSelection[0];
                        console.log("event >"+event);
                        console.log("date >"+date);
                        if (date) {
                            container.one('#<%= dayParamId %>').val(date.getDate());
                            container.one('#<%= monthParamId %>').val(date.getMonth());
                            container.one('#<%= yearParamId %>').val(date.getFullYear());
                        }
                    }
                },
                popover: {
                    zIndex: Liferay.zIndex.TOOLTIP
                },                  
                trigger: '#<%= nameId %>'
            }
        );

        datePicker.getDate = function() {
            var instance = this;

            var container = instance.get('container');

            return new Date(container.one('#<%= yearParamId %>').val(), container.one('#<%= monthParamId %>').val(), container.one('#<%= dayParamId %>').val());
        };

        return datePicker;
    }
);

Liferay.component('<%= nameId %>DatePicker');

Any help much appreciated. Is it anything related to timezone.

Попробуйте выбрать максимальную дату в качестве даты, затем, когда вы нажмете в поле ввода, введенное значение станет пустым. Этого не произойдет, если мы выберем другие даты до максимальной даты. Максимальная дата – один год с текущей даты

JS-скрипт

http://jsfiddle.net/uasvug1h/1/ (сплав 3 работал)

http://jsfiddle.net/btnkumar/uasvug1h/2/(сплав 2 не был работающий)

Как заставить это работать в сплаве 2


person Nagendra Busam    schedule 19.08.2015    source источник


Ответы (1)


Это ошибка в AlloyUI 2.0.x. Сейчас это исправлено в 3.0.x и 2.0.x, особенно в 2.0.0.62-deprecated выпуске. В настоящее время нет известных обходных путей.

person stiemannkj1    schedule 31.08.2015