Q:

How to show previous 6 months up to today's date in primefaces calendar

I need your help in applying the below requirement in the primefaces calendar that I can allow the user to select any date range from the calendar component starting from the previous 6 months from today's date until today's date.
To clear the question, the calendar component should allow the user to select date range starting from Dec-2014 up to today's date 1-May-2015 . 
My calendar component code is:
<p:calendar id="popup3" value="#{user.date4}" pattern="MMM-yyyy" />              

A:

This was done by doing the following:
private Date maxCalendarDate = new Date();
private Date minCalendarDate= new Date();
public Date getMinCalendarDate() {
    Calendar cal = Calendar.getInstance();
    cal.setTime(minCalendarDate);
    cal.add(Calendar.MONTH, -6);
    minCalendarDate = cal.getTime();        
    return minCalendarDate;
}

