I am using calendar component of primefaces. I want to set mindate=currentdate.
I want restrict user to select date before current date. I am using JSF2.0.
Just bind it as a bean property the usual way.
<p:calendar ... mindate="#{bean.currentDate}" />
By the way, the way how you created the current date is clumsy. Just invoking the Date
's own constructor is sufficient. Using the Calendar
for this purpose only brings unnecessary overhead along.
private Date currentDate = new Date();
public Date getCurrentDate() {
return currentDate;
}
<p:calendar mindate="today">
Try this,
<p:calendar mindate="calwidget.today()" widgetVar="calwidget" value="#{bean.date}">
If you are using omnifaces, you can do this:
<p:calendar ... mindate="#{now}" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With