Display data for last 15 days and next 30 days in af:calendar in ADF | Techartifact.

Requirment – In calendar component , we need to show data for last 15 days and next 30 days in list mode.

Solution-Seems little tricky. But not much.Let check out in calendar property.

Well there is property called ActiveDay and ListCount. We will be binding the ActiveDay with a managed bean and setting ActiveDay from that bean.

Create a varible like “private Date currentDate;” and generate getter setter method of it in myCalendarBean. Override the getter method of current Date.

    public void setCurrentDate(Date currentDate) {
        this.currentDate = currentDate;
    }

    public Date getCurrentDate() {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, -15);
        Date date = calendar.getTime();
        
        return date;
    }


And we need to show last 15 days and next 30 days. that mean total 45 days. We will putting 45 in ListCount.

See in below screenshot.Today is 18 nov. And we getting date range from 3 nov to 17 Dec. 🙂

And that all. nothing to do.

Happy Coding with Techartifact.