Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6350589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:50:19+00:00 2026-05-24T21:50:19+00:00

This question is mainly directed at the PrimeFaces dev team but maybe someone else

  • 0

This question is mainly directed at the PrimeFaces dev team but maybe someone else knows a workaround. I can’t upload screenshots on the PrimeFaces support forums but I can link to my question here.

Reported as a defect in PrimeFaces issue tracker. Add a star to cast your vote for the PrimeFaces development team to fix this: link to defect in their issue tracker

Discussed here in PrimeFaces support forum.

Still exists in PrimeFaces 3.0-M3-SNAPSHOT

PROBLEM:

I’m using the PrimeFaces 3.0 <p:calendar> control to allow the user to view and edit Date objects that contain both date and time. There appears to be some defect in the JavaScript control that causes it to add some strange offset to the date somewhere in the vicinity of +6 years.

I have setup some code to demonstrate the problem.

In the first <p:calendar> I use a managed bean Date that is initially null. The control is ok with that. It will open and set the initial value to the current date with hour/minute/second zeroed. I can use the sliders to set the hours, minutes and seconds normally.

Associated with initially null managed bean property - displays ok

Associated with initially null managed bean property - opens ok

In the second <p:calendar> I use a managed bean Date that is initially set to new Date(). This will create a new Date object set to the current server time. The control is not ok with that. Although the date/time displayed in the <p:calendar> box looks correct initially, it will be modified to some bizarre value in the future when the JavaScript picker control is opened. On closing the picker control the date on the managed bean is set to the bizarre value.

Associated with initially populated managed bean property - displays ok

Associated with initially populated managed bean property - opens NOT ok

Another problem that may or may not be related is when I try to use a custom format for the date:

ddHHmm’Z’MMMyy

This format is used by my customer in their domain and I need to support it somehow. The <p:calendar> JavaScript picker will not even open when I try to click on the box. Something about the pattern (which works just fine in Java SimpleDateFormat) breaks it. The PrimeFaces documentation is silent on this.

Associated with initially null value and has custom pattern - cannot open control!

QUESTION: Does anyone have any workaround for these <p:calendar> issues?

UPDATE – source code:

The composite component that wraps the <p:calendar>:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:p="http://primefaces.prime.com.tr/ui"
        xmlns:composite="http://java.sun.com/jsf/composite">

    <composite:interface 
            displayName="calendar"
            shortDescription="Wrapper for a PrimeFaces p:calendar">
        <composite:attribute 
            name="dateValue" 
            displayName="dateValue"
            type="java.util.Date"
            required="true"
            shortDescription="EL expression that evaluates to a java.util.Date on a backing bean" />
        <composite:attribute 
            name="pattern" 
            displayName="pattern"
            type="java.lang.String"
            default="dd/MM/yyyy HH:mm:ss"
            shortDescription="Pattern used to format the underlying Date value. See SimpleDatePattern class documentation for pattern syntax. NOTE: p:calendar does not appear to support some complex patterns." />
        <composite:attribute
            name="ajaxRenderTargets"
            displayName="ajaxRenderTargets"
            type="java.lang.String"
            default="@none"
            shortDescription="Space-separated list of element ids that need to be rendered by Ajax when the calendar value changes. See f:ajax render attribute documentation." />
        <composite:attribute 
            name="tooltip" 
            displayName="tooltip"
            type="java.lang.String"
            default=""
            shortDescription="String to be used as the tooltip for this component" />
        <composite:attribute 
            name="label" 
            displayName="label"
            type="java.lang.String"
            default=""
            shortDescription="Label for this component. May be used in FacesMessages." />
        <composite:attribute 
            name="required" 
            displayName="required"
            type="java.lang.Boolean"
            default="false" />
    </composite:interface>

    <composite:implementation>
        <p:calendar
                id="pCalendarInsideCC"
                value="#{cc.attrs.dateValue}" 
                pattern="#{cc.attrs.pattern}"
                readOnlyInputText="true"
                showButtonPanel="false"
                popupIconOnly="false"
                showOn="focus"
                mode="popup"
                navigator="true"
                pages="1"
                showOtherMonths="true"
                selectOtherMonths="false"
                alt="#{cc.attrs.tooltip}"
                title="#{cc.attrs.tooltip}"
                required="#{cc.attrs.required}"
                label="#{cc.attrs.label}">
            <p:ajax 
                    event="valueChange"
                    update="#{cc.attrs.ajaxRenderTargets}" />
            <p:ajax 
                    event="change"
                    update="#{cc.attrs.ajaxRenderTargets}" />
        </p:calendar>
    </composite:implementation>
</html>

The page containing the composite component references:

<ui:composition template="/templates/primefaces/masterLayout.xhtml">

    <ui:param name="title" value="#{bundle.primeFacesCalendarCC_description}" />

    <ui:define name="content">
        <h:form id="contentForm">
            <h:panelGrid columns="3">
                <h:outputText
                        value="Initially empty Date reference on managed bean" />
                <sandbox:primeFacesCalendar
                        id="calendarCC1"
                        dateValue="#{primeFacesTestBean.userSubmittedDateTime}"
                        ajaxRenderTargets="messagesCalendar1 :ajaxRenderTargetsInTemplate"
                        required="true" />
                <p:messages 
                        id="messagesCalendar1" 
                        showSummary="false" 
                        showDetail="true" />

                <h:outputText
                        value="A 'new Date()' reference on managed bean" />
                <sandbox:primeFacesCalendar
                        id="calendarCC2"
                        dateValue="#{primeFacesTestBean.newDateInstance}"
                        ajaxRenderTargets="messagesCalendar2 :ajaxRenderTargetsInTemplate"
                        required="true" />
                <p:messages 
                        id="messagesCalendar2" 
                        showSummary="false" 
                        showDetail="true" />

                <h:outputText
                        value="Initially empty Date using ddHHmm'Z'MMMyy pattern" />
                <sandbox:primeFacesCalendar
                        id="calendarCC3"
                        dateValue="#{primeFacesTestBean.userSubmittedDateTime}"
                        ajaxRenderTargets="messagesCalendar2 :ajaxRenderTargetsInTemplate"
                        pattern="ddHHmm'Z'MMMyy"
                        required="true" />
                <p:messages 
                        id="messagesCalendar3" 
                        showSummary="false" 
                        showDetail="true" />

            </h:panelGrid>
        </h:form>
    </ui:define>

</ui:composition>

<ui:composition template="/templates/primefaces/masterLayout.xhtml">

    <ui:param name="title" value="#{bundle.primeFacesCalendarCC_description}" />

    <ui:define name="content">
        <h:form id="contentForm">
            <h:panelGrid columns="3">
                <h:outputText
                        value="Initially empty Date reference on managed bean" />
                <sandbox:primeFacesCalendar
                        id="calendarCC1"
                        dateValue="#{primeFacesTestBean.userSubmittedDateTime}"
                        ajaxRenderTargets="messagesCalendar1 :ajaxRenderTargetsInTemplate"
                        required="true" />
                <p:messages 
                        id="messagesCalendar1" 
                        showSummary="false" 
                        showDetail="true" />

                <h:outputText
                        value="A 'new Date()' reference on managed bean" />
                <sandbox:primeFacesCalendar
                        id="calendarCC2"
                        dateValue="#{primeFacesTestBean.newDateInstance}"
                        ajaxRenderTargets="messagesCalendar2 :ajaxRenderTargetsInTemplate"
                        required="true" />
                <p:messages 
                        id="messagesCalendar2" 
                        showSummary="false" 
                        showDetail="true" />

                <h:outputText
                        value="Initially empty Date using ddHHmm'Z'MMMyy pattern" />
                <sandbox:primeFacesCalendar
                        id="calendarCC3"
                        dateValue="#{primeFacesTestBean.userSubmittedDateTime}"
                        ajaxRenderTargets="messagesCalendar2 :ajaxRenderTargetsInTemplate"
                        pattern="ddHHmm'Z'MMMyy"
                        required="true" />
                <p:messages 
                        id="messagesCalendar3" 
                        showSummary="false" 
                        showDetail="true" />

            </h:panelGrid>
        </h:form>
    </ui:define>

</ui:composition>

The managed bean:

@ManagedBean(name="primeFacesTestBean")
@SessionScoped
public class PrimeFacesTestBean implements Serializable {

    private static final long serialVersionUID = 1L;
    private Date userSubmittedDateTime = null;
    private Date newDateInstance = new Date();

    public void setUserSubmittedDateTime(Date userSubmittedDateTime) {
        this.userSubmittedDateTime = userSubmittedDateTime;
    }

    public Date getUserSubmittedDateTime() {
        return userSubmittedDateTime;
    }

    public void setNewDateInstance(Date newDateInstance) {
        this.newDateInstance = newDateInstance;
    }

    public Date getNewDateInstance() {
        return newDateInstance;
    }

    public void calendarValueChangeHandler(AjaxBehaviorEvent event) {
        //System.out.println("calendar value has been changed (Ajaxified)");
    }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:50:23+00:00Added an answer on May 24, 2026 at 9:50 pm

    Fixed as of August 18th in 3.0-M3-SNAPSHOT:
    http://code.google.com/p/primefaces/issues/detail?id=2215

    Confirmed that it works correctly in my webapp using the 3.0-M3-SNAPSHOT of August 23rd.

    NOTE: The custom format issue was not covered in this defect. I’m not sure if that is fixed or still a problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is mainly directed at the PrimeFaces dev team but maybe someone else
This question in mainly pointed at C/C++, but I guess other languages are relevant
This question is mainly geared towards Zend in PHP, although it certainly applies to
This question is mainly out of curiosity (I have a different working solution to
This question is mainly to verify my current idea. I have a series of
I guess this question was asked in one way or another, but I'm looking
This question sounds so easy I can't believe I can't find information on it
I am posting this question after reading other similar questions about my problem but
I've asked a question similar to this but thought I would ask a more
This question deals mainly with streams in web application in .net. In my webapplication

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.