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 8954339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:18:00+00:00 2026-06-15T14:18:00+00:00

The problem I am having is with the PrimesFaces 3.4.1 calendar. When using the

  • 0

The problem I am having is with the PrimesFaces 3.4.1 calendar. When using the popup date picker activated either through the button or on input field focus you can only select valid dates which work fine, happy days!

The issues comes when you manually add a date into the input field, if you add an invalid date the PrimeFaces calendar component takes its best guess at converting this into a valid date and then sending it, meaning that back-end validation is a no go. Some interesting translations below:

  • 30/02/2012 becomes 2/6/2014
  • 322/05/2012 becomes 5/10/2038
  • 01/14/2012 becomes 4/1/2012

To recreate this madness have a look at the PrimeFaces Calendar Showcase.

I have seen solution around using the readOnlyInput='true' attribute but that only seems to prevent letters being entered in the field not number or slashes. Below is one instance of the calendar I have implemented:

<p:calendar id="fldDateOfBirth"
            value="#{pc_CreateUser.user.dateOfBirth}"
            binding="#{pc_CreateUser.dobComp}"
            navigator="true"
            pattern="dd/MM/yyyy"
            maxlength="10"
            yearRange="-100"
            validator="#{pc_CreateUser.validateDOB}"
            title="#{msg.user_date_format_default_tip}"
            converterMessage="#{msg.user_error_dob_invalid}"
            readOnlyInput="true"
            showOn="button" />

Solution wise I am open to any suggestions:

  1. Is this a common issues in PrimeFaces? Is there a trick I can use to
    fix it?
  2. Could I use JavaScript to validate the date before it’s sent or to
    block all user input entirely?
  3. Anything else I haven’t thought of!

Thanks in advance, this has been causing me issues for weeks!

  • 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-06-15T14:18:01+00:00Added an answer on June 15, 2026 at 2:18 pm

    The <p:calendar> uses under the covers SimpleDateFormat which in turn uses by default lenient parsing, causing the overflowed values to roll over into the next date metric level. E.g. 32 January would become 1 February, etc.

    In plain Java terms, this can be turned off by DateFormat#setLenient(), passing false. See also among others this question: validating a date using dateformat.

    In JSF terms, you basically need to provide a custom converter which uses a non-lenient DateFormat. Fortunately, standard JSF already provides such one out the box in flavor of <f:convertDateTime>, so you could just make use of it directly.

    <p:calendar ...>
        <f:convertDateTime pattern="dd/MM/yyyy" />
    </p:calendar>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having problem using mvc:resources in spring 3.1 configuration. Initially i was working
I having problem marshaling an iterator of objects using JAXB User class: @XmlRootElement(name=User) public
I having problem in my application.. I am pressing back button in my third
i'm having problem when i want to select element using querySelector <ul class=xoxo blogroll>
I'm having problem with SHGetFileInfoW function I'm using. It's a quite slow and first
am having problem, my app doesn't seem to check the radio button based from
I having problem using CHCSVwriter to export my arrays to CSV or excel file.
Im having problem with single value inserts. Using pyodbc LL= [] .... sqla =
Im having problem's adding map markers to gmaps using jquery. Here is my code
I am having problem rightnow because when I am logging in on mysql using

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.