@Override
    protected void encodeScript(FacesContext context, DatePicker component, String value) throws IOException {
        Locale locale = component.calculateLocale(context);
        String pattern = component.calculateWidgetPattern();
        WidgetBuilder wb = getWidgetBuilder(context);
        wb.init("DatePicker", component);

        String defaultDate = null;

        if (component.isConversionFailed()) {
            Class<?> dateType = resolveDateType(context, component);
            defaultDate = CalendarUtils.getValueAsString(context, component, CalendarUtils.now(component, dateType), true);
        }
        else if (!isValueBlank(value)) {
            defaultDate = value;
        }

        // #9559 java locale must match UI local for AM/PM
        DateFormatSymbols symbols = new DateFormatSymbols(locale);
        String[] ampm = symbols.getAmPmStrings();

        String selectionMode = component.getSelectionMode();

        wb.attr("defaultDate", defaultDate, null)
            .attr("inline", component.isInline())
            .attr("userLocale", locale.toString())
            .attr("flex", ComponentUtils.isFlex(context, component), false)
            .attr("localeAm", ampm[0], "AM")
            .attr("localePm", ampm[1], "PM")
            .attr("dateFormat", CalendarUtils.convertPattern(pattern))
            .attr("showIcon", component.isShowIcon(), false)
            .attr("buttonTabindex", component.getButtonTabindex())
            .attr("focusOnSelect", component.isFocusOnSelect(), false)
            .attr("disabled", component.isDisabled(), false)
            .attr("valid", component.isValid(), true)
            .attr("yearRange", component.getYearRange(), null)
            .attr("minDate", getMinMaxDate(context, component, component.getMindate(), false), null)
            .attr("maxDate", getMinMaxDate(context, component, component.getMaxdate(), true), null)
            .attr("selectionMode", selectionMode, null)
            .attr("showOnFocus", component.isShowOnFocus())
            .attr("shortYearCutoff", component.getShortYearCutoff(), null)
            .attr("monthNavigator", component.isMonthNavigator(), false)
            .attr("yearNavigator", component.getYearNavigator().toLowerCase(Locale.ROOT), "false")
            .attr("showButtonBar", component.isShowButtonBar(), false)
            .attr("showMinMaxRange", component.isShowMinMaxRange(), true)
            .attr("autoMonthFormat", component.isAutoMonthFormat(), true)
            .attr("panelStyleClass", component.getPanelStyleClass(), null)
            .attr("panelStyle", component.getPanelStyle(), null)
            .attr("keepInvalid", component.isKeepInvalid(), false)
            .attr("maxDateCount", component.getMaxDateCount(), Integer.MAX_VALUE)
            .attr("numberOfMonths", component.getNumberOfMonths(), 1)
            .attr("view", component.getView(), null)
            .attr("autoDetectDisplay", component.isAutoDetectDisplay(), true)
            .attr("responsiveBreakpoint", component.getResponsiveBreakpoint(), DatePicker.RESPONSIVE_BREAKPOINT_SMALL)
            .attr("touchUI", component.isTouchUI(), false)
            .attr("showWeek", component.isShowWeek(), false)
            .attr("showLongMonthNames", component.isShowLongMonthNames(), false)
            .attr("appendTo", SearchExpressionUtils.resolveOptionalClientIdForClientSide(context, component, component.getAppendTo()))
            .attr("icon", component.getTriggerButtonIcon(), null)
            .attr("rangeSeparator", component.getRangeSeparator(), "-")
            .attr("timeSeparator", component.getTimeSeparator(), ":")
            .attr("fractionSeparator", component.getFractionSeparator(), ".")
            .attr("timeInput", component.isTimeInput())
            .attr("timeZone", component.getTimeZone() == null ? null : CalendarUtils.calculateZoneId(component.getTimeZone()).toString(), null)
            .attr("touchable", ComponentUtils.isTouchable(context, component), true)
            .attr("readonly", component.isReadonly(), false)
            .attr("lazyModel", component.getModel() instanceof LazyDateMetadataModel, false);

        List<Integer> disabledDays = component.getDisabledDays();
        if (disabledDays != null) {
            CalendarUtils.encodeListValue(context, component, "disabledDays", disabledDays, pattern);
        }

        List<Object> disabledDates = component.getInitialDisabledDates(context);
        if (disabledDates != null) {
            CalendarUtils.encodeListValue(context, component, "disabledDates", disabledDates, pattern);
        }

        List enabledDates = component.getInitialEnabledDates(context);
        if (enabledDates != null && !enabledDates.isEmpty()) {
            CalendarUtils.encodeListValue(context, component, "enabledDates", enabledDates, pattern);
        }
        encodeScriptDateStyleClasses(wb, component);

        String dateTemplate = component.getDateTemplate();
        if (dateTemplate != null) {
            wb.nativeAttr("dateTemplate", dateTemplate);
        }

        String beforeShow = component.getBeforeShow();
        if (beforeShow != null) {
            wb.nativeAttr("preShow", beforeShow);
        }

        String onMonthChange = component.getOnMonthChange();
        if (onMonthChange != null) {
            wb.nativeAttr("onMonthChange", onMonthChange);
        }

        String onYearChange = component.getOnYearChange();
        if (onYearChange != null) {
            wb.nativeAttr("onYearChange", onYearChange);
        }

        String weekCalculator = component.getWeekCalculator();
        if (weekCalculator != null) {
            wb.nativeAttr("weekCalculator", weekCalculator);
        }

        if (component.isShowOtherMonths()) {
            wb.attr("showOtherMonths", true).attr("selectOtherMonths", component.isSelectOtherMonths());
        }

        if (component.hasTime()) {
            wb.attr("showTime", component.isShowTime(), false)
                .attr("hourFormat", component.getHourFormat(), null)
                .attr("timeOnly", component.isTimeOnly(), false)
                .attr("showSeconds", component.isShowSeconds(), false)
                .attr("showMilliseconds", component.isShowMilliseconds(), false)
                .attr("stepHour", component.getStepHour(), 1)
                .attr("stepMinute", component.getStepMinute(), 1)
                .attr("stepSecond", component.getStepSecond(), 1)
                .attr("stepMillisecond", component.getStepSecond(), 1)
                .attr("hideOnDateTimeSelect", component.isHideOnDateTimeSelect(), false)
                .attr("defaultHour", component.getDefaultHour())
                .attr("defaultMinute", component.getDefaultMinute())
                .attr("defaultSecond", component.getDefaultSecond())
                .attr("defaultMillisecond", component.getDefaultMillisecond());
        }


        if ("range".equalsIgnoreCase(selectionMode)) {
            wb.attr("hideOnRangeSelection", component.isHideOnRangeSelection(), false);
        }

        String mask = component.getMask();
        if (mask != null && !"false".equals(mask)) {
            wb.attr("mask", resolveMask(component, mask))
                .attr("maskSlotChar", component.getMaskSlotChar(), "_")
                .attr("maskAutoClear", component.isMaskAutoClear(), true);
        }

        encodeClientBehaviors(context, component);

        wb.finish();
    }
Initializes the default settings for the DatePicker component based on its pattern and value type.

@param context the FacesContext instance
@param datePicker the DatePicker component to initialize
primefaces/src/main/java/org/primefaces/component/datepicker/DatePickerRenderer.java