I want to get the date from a rich:calendar component in javascript in order to compare it with another date and disable the dates which are over or under each other (“from” date can’t be after “to” date) I know how to disable dates, but I haven’t been able to get the date,
I’ve tried with:
#{rich:element('FromDate')}.component.getSelectedDate().getTime()
#{rich:component('FromDate')}.getSelectedDate().getTime()
#{rich:component('FromDate')}.Date.getTime()
#{rich:component('FromDate')}.getTime()
the idea is to after it make a comparation like
function disablementFunction(day){
if (#{rich:element('FromDate')}.component.getSelectedDate().getTime() -
day.date.getTime() >= 0) {
return false;
}
return true;
}
You can use Richfaces js api to get the current date:
Just for clarification your code snippet will become something like:
Of Course you can still refer to this date using el expression: