primefaces calendar component is getting Date by default. Can I get only month and year without dates.
How to get only month and year
I just hid the table of the day picker with CSS. I also had to create my own arrows for navigating, because the standard arrows do not fire the dateSelect event.
Markup:
CSS:
.tableView table,
.tableView a.ui-datepicker-prev,
.tableView a.ui-datepicker-next {
display: none;
}
Bean methods:
public void decrementMonth() throws Exception {
Calendar c = Calendar.getInstance();
c.setTime(this.selectedDate);
c.add(Calendar.MONTH, -1);
//... business logic to update date dependent data
}
public void incrementMonth() throws Exception {
Calendar c = Calendar.getInstance();
c.setTime(this.selectedDate);
c.add(Calendar.MONTH, 1);
//... business logic to update date dependent data
}
Result (PrimeFaces 3.4.2):
