Page 1 of 1

Datepicker dateonly mode when value is localdatetime

Posted: 07 Apr 2021, 16:17
by undermensch
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.

Re: Datepicker dateonly mode when value is localdatetime

Posted: 07 Apr 2021, 21:51
by Melloware
Did you try showTime="false" that should disable the time.

Re: Datepicker dateonly mode when value is localdatetime

Posted: 07 Apr 2021, 22:53
by undermensch
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".