RE: How to disable past dates with liferay-ui:input-date

Jamie Sammons, modified 3 Years ago. New Member Posts: 3 Join Date: 2/3/22 Recent Posts

Hey, everyone!

I was trying to disable in the calendar and in the liferay-ui:input-date the value of a past date (allow just the dates after now), but I haven't found a solution on the Internet. Could anyone help me?

My code is here (JSP):

<liferay-ui:input-date 
                    name="fechaPubl" yearValue="<%=nowDate.get(nowDate.YEAR)%>"
			        monthValue="<%=nowDate.get(nowDate.MONTH)%>"
			        dayValue="<%=nowDate.get(nowDate.DAY_OF_MONTH)%>" dayParam="dateFrom-day"
			        monthParam="dateFrom-month" yearParam="dateFrom-year">
</liferay-ui:input-date>

Thanks ind advance!

thumbnail
Jamie Sammons, modified 3 Years ago. New Member Posts: 21 Join Date: 11/5/14 Recent Posts

You can use the firstEnabledDate parameter like this:

<liferay-ui:input-date firstEnabledDate="<%= new Date()  %>" />

Hope it helps.

thumbnail
Gennaro Lippiello, modified 3 Years ago. Junior Member Posts: 39 Join Date: 3/9/22 Recent Posts

Hi, have you tried the firstEnabledDate attribute? Just add 

firstEnabledDate="<%=new Date()%>"

Take a look here liferay-ui/input-date