Datepicker dateonly mode when value is localdatetime

UI Components for JSF
Post Reply
User avatar
undermensch
Posts: 140
Joined: 08 Jul 2010, 14:37
Location: Florida, United States

07 Apr 2021, 16:17

If I have a schedule with events and these events have begin and end properties which are LocalDateTimes, it would be nice if I have an all day property for an event to not show the time input of the datepicker component. I believe this is possible with p:calendar. This could be done using pattern, but if I have a datepicker with pattern="MM/dd/yyyy" the time input is still displayed if the value is a localdatetime. It seems that the only way currently to not display the time input is to use a localdate.

Code: Select all

<p:datePicker pattern="MM/dd/yyyy" value="#{backingbean.somelocaldatetime}"/>

<p:datePicker dateOnly="#{backingbean.event.allDay}" value="#{backingbean.somelocaldatetime}"/>
Thanks.
PrimeFaces-11.0.6 / Wildfly 24

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

07 Apr 2021, 21:51

Did you try showTime="false" that should disable the time.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

User avatar
undermensch
Posts: 140
Joined: 08 Jul 2010, 14:37
Location: Florida, United States

07 Apr 2021, 22:53

Thank you. That hides the time input. The attribute does what it says. However if the datepicker value is a localDateTime and showTime is set to false, I get a converter error: "...cannot be recognized as a date".
PrimeFaces-11.0.6 / Wildfly 24

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests