Example usage for org.joda.time DateTime dayOfMonth

List of usage examples for org.joda.time DateTime dayOfMonth

Introduction

In this page you can find the example usage for org.joda.time DateTime dayOfMonth.

Prototype

public Property dayOfMonth() 

Source Link

Document

Get the day of month property which provides access to advanced functionality.

Usage

From source file:org.jpos.qi.components.DateRange.java

License:Open Source License

private static Map<String, Date> createEndDateMap() {
    QI app = (QI) UI.getCurrent();//from www. j av a2  s.c om
    DateTime dt = DateTime.now().millisOfDay().withMaximumValue();
    Map<String, Date> map = new HashMap<>();
    map.put(LAST_HOUR, DateTime.now().toDate());
    map.put(TODAY, dt.toDate());
    map.put(YESTERDAY, dt.minusDays(1).toDate());
    map.put(THIS_WEEK, dt.dayOfWeek().withMaximumValue().toDate());
    map.put(LAST_WEEK, dt.dayOfWeek().withMaximumValue().minusWeeks(1).toDate());
    map.put(THIS_MONTH, dt.dayOfMonth().withMaximumValue().toDate());
    map.put(LAST_MONTH, dt.dayOfMonth().withMaximumValue().minusMonths(1).toDate());
    map.put(THIS_YEAR, dt.dayOfYear().withMaximumValue().toDate());
    map.put(ALL_TIME, null);
    return map;
}

From source file:org.kemri.wellcome.dhisreport.api.utils.MonthlyPeriod.java

License:Open Source License

public MonthlyPeriod(Date date) {
    DateTime dt = new DateTime(date);
    startDate = dt.dayOfMonth().withMinimumValue().toDate();
    endDate = dt.dayOfMonth().withMaximumValue().withTime(23, 59, 59, 999).toDate();
}

From source file:org.kuali.coeus.propdev.impl.budget.ProposalBudgetNumberOfMonthsServiceImpl.java

License:Open Source License

@Override
public double getNumberOfMonth(Date startDate, Date endDate) {
    if (startDate == null || endDate == null || startDate.after(endDate)) {
        return 0.00;
    }//  w  w w.  j  a v a2s  .  c  o m

    final DateTime start = new DateTime(startDate);
    final DateTime end = new DateTime(endDate).plusDays(1);

    final int daysInMonthForEndDate = end.dayOfMonth().getMaximumValue();
    final int wholeMonths = Months.monthsBetween(start, end).getMonths();
    final int daysRemaining = Days.daysBetween(start.plusMonths(wholeMonths), end).getDays();

    //casting to ensure we don't loose precision
    final double numberOfMonths = wholeMonths + ((double) daysRemaining / (double) daysInMonthForEndDate);

    return new ScaleTwoDecimal(numberOfMonths).doubleValue();
}

From source file:org.kuali.kpme.core.calendar.entry.service.CalendarEntryServiceImpl.java

License:Educational Community License

private DateTime plusSemiMonth(DateTime date) {
    //so assuming the common pairs of this are the 1st & 16th, and then 15th and the last day,
    // and 14th with the last day minus 1
    //so we'll peek at the current date and try to figure out the best guesses for addition.
    if (date.getDayOfMonth() == date.dayOfMonth().getMaximumValue()) {
        //date is on the last day of the month.  Set next date to the 15th
        return date.plusMonths(1).withDayOfMonth(15);
    } else if (date.getDayOfMonth() == 15) {
        //we are on the 15th of the month, so now lets go to the end of the month
        return date.withDayOfMonth(date.dayOfMonth().getMaximumValue());
    } else if (date.getDayOfMonth() == 1) {
        //first of the month, next would be 16
        return date.withDayOfMonth(16);
    } else if (date.getDayOfMonth() == 16) {
        //16th, so add a month and set day to '1'
        return date.plusMonths(1).withDayOfMonth(1);
    } else if (date.getDayOfMonth() == 14) {
        //14th day, set next one to last day minus 1
        return date.withDayOfMonth(date.dayOfMonth().getMaximumValue() - 1);
    } else if (date.getDayOfMonth() == date.dayOfMonth().getMaximumValue() - 1) {
        //date is on the second to last day of the month.  Set next date to the 14th
        return date.plusMonths(1).withDayOfMonth(14);
    } else {//from   w w w .ja  v a2 s .  c o  m
        // so it isn't one of the common dates... i guess we'll just add 15 days...
        return date.plusDays(15);
    }
}

From source file:org.kuali.kpme.tklm.leave.accrual.service.AccrualServiceImpl.java

License:Educational Community License

@Override
public DateTime getPreviousAccrualIntervalDate(String earnInterval, DateTime aDate) {
    DateTime previousAccrualIntervalDate = null;

    if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.DAILY)) {
        previousAccrualIntervalDate = aDate.minusDays(1);
    } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.WEEKLY)) {
        previousAccrualIntervalDate = aDate.minusWeeks(1).withDayOfWeek(DateTimeConstants.SATURDAY);
    } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.SEMI_MONTHLY)) {
        previousAccrualIntervalDate = aDate.minusDays(15);
        if (previousAccrualIntervalDate.getDayOfMonth() <= 15) {
            previousAccrualIntervalDate = previousAccrualIntervalDate.withDayOfMonth(15);
        } else {/*from   w  ww. jav  a  2  s .  c  o m*/
            previousAccrualIntervalDate = previousAccrualIntervalDate
                    .withDayOfMonth(previousAccrualIntervalDate.dayOfMonth().getMaximumValue());
        }
    } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.MONTHLY)) {
        previousAccrualIntervalDate = aDate.minusMonths(1);
        previousAccrualIntervalDate = previousAccrualIntervalDate
                .withDayOfMonth(previousAccrualIntervalDate.dayOfMonth().getMaximumValue());
    } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.YEARLY)) {
        previousAccrualIntervalDate = aDate.minusYears(1);
        previousAccrualIntervalDate = previousAccrualIntervalDate
                .withDayOfYear(previousAccrualIntervalDate.dayOfYear().getMaximumValue());
    } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.NO_ACCRUAL)) {
        previousAccrualIntervalDate = aDate;
    }

    return previousAccrualIntervalDate;
}

From source file:org.kuali.kpme.tklm.leave.accrual.service.AccrualServiceImpl.java

License:Educational Community License

@Override
public DateTime getNextAccrualIntervalDate(String earnInterval, DateTime aDate) {
    DateTime nextAccrualIntervalDate = null;

    if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.DAILY)) {
        nextAccrualIntervalDate = aDate;
    } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.WEEKLY)) {
        if (aDate.getDayOfWeek() != DateTimeConstants.SATURDAY) {
            nextAccrualIntervalDate = aDate.withDayOfWeek(DateTimeConstants.SATURDAY);
        } else {//  www  .j a v  a2s.co  m
            nextAccrualIntervalDate = aDate.withWeekOfWeekyear(1);
        }
    } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.SEMI_MONTHLY)) {
        if (aDate.getDayOfMonth() <= 15) {
            nextAccrualIntervalDate = aDate.withDayOfMonth(15);
        } else {
            nextAccrualIntervalDate = aDate.withDayOfMonth(aDate.dayOfMonth().getMaximumValue());
        }
    } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.MONTHLY)) {
        nextAccrualIntervalDate = aDate.withDayOfMonth(aDate.dayOfMonth().getMaximumValue());
    } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.YEARLY)) {
        nextAccrualIntervalDate = aDate.withDayOfYear(aDate.dayOfYear().getMaximumValue());
    } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.NO_ACCRUAL)) {
        nextAccrualIntervalDate = aDate;
    }

    return nextAccrualIntervalDate;
}

From source file:org.kuali.kpme.tklm.leave.accrual.service.AccrualServiceImpl.java

License:Educational Community License

@Override
public int getWorkDaysInAccrualInterval(String earnInterval, DateTime aDate) {
    if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.DAILY)) {
        return 1;
    } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.WEEKLY)) {
        return 5;
    } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.SEMI_MONTHLY)) {
        if (aDate.getDayOfMonth() <= 15) {
            return TKUtils.getWorkDays(aDate.withDayOfMonth(1), aDate.withDayOfMonth(15));
        } else {//  w w  w  .j a va 2 s  . c o  m
            return TKUtils.getWorkDays(aDate.withDayOfMonth(16),
                    aDate.withDayOfMonth(aDate.dayOfMonth().getMaximumValue()));
        }
    } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.MONTHLY)) {
        return TKUtils.getWorkDays(aDate.withDayOfMonth(1),
                aDate.withDayOfMonth(aDate.dayOfMonth().getMaximumValue()));
    } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.YEARLY)) {
        return TKUtils.getWorkDays(aDate.withDayOfYear(1),
                aDate.withDayOfYear(aDate.dayOfYear().getMaximumValue()));
    } else if (earnInterval.equals(HrConstants.ACCRUAL_EARN_INTERVAL_CODE.NO_ACCRUAL)) {
        return 0;
    }
    return 0;
}

From source file:org.kuali.kpme.tklm.leave.accrual.service.AccrualServiceImpl.java

License:Educational Community License

public DateTime getRuleStartDate(String earnInterval, LocalDate serviceDate, Long startAcc) {
    DateTime ruleStartDate = null;

    String intervalValue = HrConstants.SERVICE_UNIT_OF_TIME.get(earnInterval);

    if (intervalValue.equals("Months")) {
        ruleStartDate = serviceDate.toDateTimeAtStartOfDay().plusMonths(startAcc.intValue());
        if (ruleStartDate.getDayOfMonth() > ruleStartDate.dayOfMonth().getMaximumValue()) {
            ruleStartDate = ruleStartDate.withDayOfMonth(ruleStartDate.dayOfMonth().getMaximumValue());
        }//  ww  w .j  a  v a2s.com
    } else if (intervalValue.equals("Years")) {
        ruleStartDate = serviceDate.toDateTimeAtStartOfDay().withYear(startAcc.intValue());
    } else {
        ruleStartDate = serviceDate.toDateTimeAtStartOfDay();
    }

    return ruleStartDate;
}

From source file:org.kuali.kpme.tklm.leave.calendar.LeaveCalendar.java

License:Educational Community License

public LeaveCalendar(String principalId, CalendarEntry calendarEntry, List<String> assignmentKeys) {
    super(calendarEntry);

    DateTime currentDisplayDateTime = getBeginDateTime();
    DateTime endDisplayDateTime = getEndDateTime();

    // Fill in the days if the first day or end day is in the middle of the week
    if (currentDisplayDateTime.getDayOfWeek() != DateTimeConstants.SUNDAY) {
        currentDisplayDateTime = currentDisplayDateTime.minusDays(currentDisplayDateTime.getDayOfWeek());
    }/*from w  w w . jav  a  2 s.  co  m*/
    if (endDisplayDateTime.getDayOfWeek() != DateTimeConstants.SATURDAY) {
        endDisplayDateTime = endDisplayDateTime
                .plusDays(DateTimeConstants.SATURDAY - endDisplayDateTime.getDayOfWeek());
    }

    LeaveCalendarWeek leaveCalendarWeek = new LeaveCalendarWeek();
    Integer dayNumber = 0;
    List<LeaveBlock> blocks = LmServiceLocator.getLeaveBlockService().getLeaveBlocks(principalId,
            calendarEntry.getBeginPeriodFullDateTime().toLocalDate(),
            calendarEntry.getEndPeriodFullDateTime().toLocalDate());
    Map<String, List<LeaveBlock>> leaveBlockMap = new HashMap<String, List<LeaveBlock>>();
    for (LeaveBlock lb : blocks) {
        String key = lb.getLeaveLocalDate().toString();
        if (leaveBlockMap.containsKey(key)) {
            leaveBlockMap.get(key).add(lb);
        } else {
            leaveBlockMap.put(key, createNewLeaveBlockList(lb));
        }
    }

    //KPME-2560 If leave calendar document is final status, then User wont be able to add leave blocks to the calendar. 
    Boolean dayEditableFlag = true;
    LeaveCalendarDocumentHeader header = LmServiceLocator.getLeaveCalendarDocumentHeaderService()
            .getDocumentHeader(principalId, calendarEntry.getBeginPeriodFullDateTime(),
                    calendarEntry.getEndPeriodFullDateTime());
    if (header != null && header.getDocumentStatus().equals(HrConstants.ROUTE_STATUS.FINAL))
        dayEditableFlag = false;

    while (currentDisplayDateTime.isBefore(endDisplayDateTime)
            || currentDisplayDateTime.isEqual(endDisplayDateTime)) {
        LeaveCalendarDay leaveCalendarDay = new LeaveCalendarDay();

        // If the day is not within the current pay period, mark them as read only (gray)
        if (currentDisplayDateTime.isBefore(getBeginDateTime())
                || currentDisplayDateTime.isEqual(getEndDateTime())
                || currentDisplayDateTime.isAfter(getEndDateTime())) {
            leaveCalendarDay.setGray(true);
        } else {
            // This is for the div id of the days on the calendar.
            // It creates a day id like day_11/01/2011 which will make day parsing easier in the javascript.
            //                leaveCalendarDay.setDayNumberDelta(currDateTime.toString(HrConstants.DT_BASIC_DATE_FORMAT));
            //                leaveCalendarDay.setDayNumberDelta(currDateTime.getDayOfMonth());
            leaveCalendarDay.setDayNumberDelta(dayNumber);

            LocalDate leaveDate = currentDisplayDateTime.toLocalDate();
            List<LeaveBlock> lbs = leaveBlockMap.get(currentDisplayDateTime.toLocalDate().toString());
            if (lbs == null) {
                lbs = Collections.emptyList();
            }
            // use given assignmentKeys to control leave blocks displayed on the calendar
            if (CollectionUtils.isNotEmpty(lbs) && CollectionUtils.isNotEmpty(assignmentKeys)) {
                List<LeaveBlock> leaveBlocks = LmServiceLocator.getLeaveBlockService()
                        .filterLeaveBlocksForLeaveCalendar(lbs, assignmentKeys);
                leaveCalendarDay.setLeaveBlocks(leaveBlocks);
            } else {
                leaveCalendarDay.setLeaveBlocks(lbs);
            }

            if (HrServiceLocator.getHRPermissionService().canViewLeaveTabsWithNEStatus()) {
                TimesheetDocumentHeader tdh = TkServiceLocator.getTimesheetDocumentHeaderService()
                        .getDocumentHeaderForDate(principalId, leaveDate.toDateTimeAtStartOfDay());
                if (tdh != null) {
                    if (DateUtils.isSameDay(leaveDate.toDate(), tdh.getEndDate())
                            || leaveDate.isAfter(LocalDate.fromDateFields(tdh.getEndDate()))) {
                        leaveCalendarDay.setDayEditable(true);
                    }
                } else {
                    leaveCalendarDay.setDayEditable(true);
                }
            } else {
                leaveCalendarDay.setDayEditable(true);
            }
            //KPME-2560 If leave calendar document is final status, then User wont be able to add leave blocks to the calendar. 
            if (!dayEditableFlag)
                leaveCalendarDay.setDayEditable(false);

            dayNumber++;
        }
        leaveCalendarDay.setDayNumberString(currentDisplayDateTime.dayOfMonth().getAsShortText());
        leaveCalendarDay.setDateString(currentDisplayDateTime.toString(HrConstants.DT_BASIC_DATE_FORMAT));

        leaveCalendarWeek.getDays().add(leaveCalendarDay);

        if (leaveCalendarWeek.getDays().size() == DateTimeConstants.DAYS_PER_WEEK) {
            getWeeks().add(leaveCalendarWeek);
            leaveCalendarWeek = new LeaveCalendarWeek();
        }

        currentDisplayDateTime = currentDisplayDateTime.plusDays(1);
    }

    if (!leaveCalendarWeek.getDays().isEmpty()) {
        getWeeks().add(leaveCalendarWeek);
    }

    boolean isPlanningCal = LmServiceLocator.getLeaveCalendarService().isLeavePlanningCalendar(principalId,
            calendarEntry.getBeginPeriodFullDateTime().toLocalDate(),
            calendarEntry.getEndPeriodFullDateTime().toLocalDate());
    Map<String, String> earnCodes = HrServiceLocator.getEarnCodeService().getEarnCodesForDisplay(principalId,
            isPlanningCal);
    setEarnCodeList(earnCodes);
}

From source file:org.kuali.kpme.tklm.leave.calendar.LeaveRequestCalendar.java

License:Educational Community License

public LeaveRequestCalendar(DateTime beginDateTime, DateTime endDateTime,
        Map<String, List<LeaveRequestDocument>> leaveReqDocsMap, Map<String, List<LeaveBlock>> leaveBlocksMap,
        Map<String, List<LeaveBlockHistory>> disapprovedLBMap, String calendarType) {
    this.calendarType = calendarType;
    setBeginDateTime(beginDateTime);//from  w  w  w . ja  v a  2  s . com
    setEndDateTime(endDateTime);

    DateTime currentDisplayDateTime = new DateTime(beginDateTime.getMillis());
    DateTime endDisplayDateTime = new DateTime(endDateTime.getMillis());

    // Fill in the days if the first day or end day is in the middle of the week
    if (currentDisplayDateTime.getDayOfWeek() != DateTimeConstants.SUNDAY) {
        currentDisplayDateTime = currentDisplayDateTime.minusDays(currentDisplayDateTime.getDayOfWeek());
    }
    if (endDisplayDateTime.getDayOfWeek() != DateTimeConstants.SATURDAY) {
        endDisplayDateTime = endDisplayDateTime
                .plusDays(DateTimeConstants.SATURDAY - endDisplayDateTime.getDayOfWeek());
    }

    LeaveRequestCalendarWeek leaveReqCalendarWeek = new LeaveRequestCalendarWeek();
    Integer dayNumber = 0;

    while (currentDisplayDateTime.isBefore(endDisplayDateTime)
            || currentDisplayDateTime.isEqual(endDisplayDateTime)) {
        LeaveRequestCalendarDay leaveReqCalendarDay = new LeaveRequestCalendarDay();

        // If the day is not within the current pay period, mark them as read only (gray)
        if (StringUtils.equalsIgnoreCase("M", calendarType)
                && (currentDisplayDateTime.isBefore(getBeginDateTime())
                        || currentDisplayDateTime.isEqual(getEndDateTime())
                        || currentDisplayDateTime.isAfter(getEndDateTime()))) {
            leaveReqCalendarDay.setGray(true);
        } else {
            // This is for the div id of the days on the calendar.
            // It creates a day id like day_11/01/2011 which will make day parsing easier in the javascript.
            leaveReqCalendarDay.setDayNumberDelta(dayNumber);

            List<LeaveRequestDocument> reqDocs = leaveReqDocsMap
                    .get(currentDisplayDateTime.toLocalDate().toString());
            List<LeaveBlock> leaveBlocks = leaveBlocksMap.get(currentDisplayDateTime.toLocalDate().toString());
            List<LeaveBlockHistory> disapprovedBlocks = disapprovedLBMap
                    .get(currentDisplayDateTime.toLocalDate().toString());
            List<LeaveRequestApprovalRow> rowList = new ArrayList<LeaveRequestApprovalRow>();
            if (reqDocs == null) {
                reqDocs = Collections.emptyList();
            }
            if (leaveBlocks == null) {
                leaveBlocks = Collections.emptyList();
            }
            List<String> leaveBlockIds = new ArrayList<String>();
            if (!reqDocs.isEmpty()) {
                for (LeaveRequestDocument lrd : reqDocs) {
                    LeaveBlock lb = lrd.getLeaveBlock();
                    leaveBlockIds.add(lb.getLmLeaveBlockId());
                    String principalId = lb.getPrincipalId();
                    LeaveRequestApprovalRow aRow = new LeaveRequestApprovalRow();
                    // Set Employee Name 
                    EntityNamePrincipalName entityNamePrincipalName = KimApiServiceLocator.getIdentityService()
                            .getDefaultNamesForPrincipalId(principalId);
                    if (entityNamePrincipalName != null) {
                        aRow.setPrincipalId(principalId);
                        aRow.setEmployeeName(
                                entityNamePrincipalName.getDefaultName() == null ? StringUtils.EMPTY
                                        : entityNamePrincipalName.getDefaultName().getCompositeName());
                    }
                    aRow.setLeaveRequestDocId(lrd.getDocumentNumber());
                    aRow.setLeaveCode(lb.getEarnCode());
                    aRow.setRequestedDate(TKUtils.formatDate(lb.getLeaveLocalDate()));
                    aRow.setRequestedHours(lb.getLeaveAmount().toString());
                    aRow.setDescription(
                            lrd.getDescription() == null ? lb.getDescription() : lrd.getDescription());
                    aRow.setAssignmentTitle(lb.getAssignmentTitle());
                    aRow.setRequestStatus(lb.getRequestStatusString().toLowerCase());
                    rowList.add(aRow);
                }
            }

            if (!leaveBlocks.isEmpty()) {
                for (LeaveBlock lb : leaveBlocks) {
                    if (!leaveBlockIds.contains(lb.getLmLeaveBlockId())) {
                        String principalId = lb.getPrincipalId();
                        LeaveRequestApprovalRow aRow = new LeaveRequestApprovalRow();
                        // Set Employee Name 
                        EntityNamePrincipalName entityNamePrincipalName = KimApiServiceLocator
                                .getIdentityService().getDefaultNamesForPrincipalId(principalId);
                        if (entityNamePrincipalName != null) {
                            aRow.setPrincipalId(principalId);
                            aRow.setEmployeeName(
                                    entityNamePrincipalName.getDefaultName() == null ? StringUtils.EMPTY
                                            : entityNamePrincipalName.getDefaultName().getCompositeName());
                        }
                        aRow.setLeaveCode(lb.getEarnCode());
                        aRow.setRequestedDate(TKUtils.formatDate(lb.getLeaveLocalDate()));
                        aRow.setRequestedHours(lb.getLeaveAmount().toString());
                        aRow.setRequestStatus(lb.getRequestStatusString().toLowerCase());
                        aRow.setDescription(lb.getDescription());
                        aRow.setAssignmentTitle(lb.getAssignmentTitle());
                        rowList.add(aRow);
                    }
                }
            }
            // Adding disapproved blocks.
            if (disapprovedBlocks != null && !disapprovedBlocks.isEmpty()) {
                for (LeaveBlockHistory lb : disapprovedBlocks) {
                    String principalId = lb.getPrincipalId();
                    LeaveRequestApprovalRow aRow = new LeaveRequestApprovalRow();
                    // Set Employee Name 
                    EntityNamePrincipalName entityNamePrincipalName = KimApiServiceLocator.getIdentityService()
                            .getDefaultNamesForPrincipalId(principalId);
                    if (entityNamePrincipalName != null) {
                        aRow.setPrincipalId(principalId);
                        aRow.setEmployeeName(
                                entityNamePrincipalName.getDefaultName() == null ? StringUtils.EMPTY
                                        : entityNamePrincipalName.getDefaultName().getCompositeName());
                    }
                    aRow.setLeaveCode(lb.getEarnCode());
                    aRow.setRequestedDate(TKUtils.formatDate(lb.getLeaveLocalDate()));
                    aRow.setRequestedHours(lb.getLeaveAmount().toString());
                    aRow.setRequestStatus(lb.getRequestStatusString().toLowerCase());
                    aRow.setDescription(lb.getDescription());
                    aRow.setAssignmentTitle(lb.getAssignmentTitle());
                    rowList.add(aRow);
                }
            }

            leaveReqCalendarDay.setLeaveReqRows(rowList);
            if (!rowList.isEmpty() && rowList.size() > 0) {
                requestList.addAll(rowList);
            }
            dayNumber++;
        }

        leaveReqCalendarDay.setDayNumberString(currentDisplayDateTime.dayOfMonth().getAsShortText());
        leaveReqCalendarDay
                .setDateString(currentDisplayDateTime.toString(HrConstants.DateTimeFormats.BASIC_DATE_FORMAT));

        leaveReqCalendarWeek.getDays().add(leaveReqCalendarDay);

        if (leaveReqCalendarWeek.getDays().size() == DateTimeConstants.DAYS_PER_WEEK) {
            getWeeks().add(leaveReqCalendarWeek);
            leaveReqCalendarWeek = new LeaveRequestCalendarWeek();
        }

        currentDisplayDateTime = currentDisplayDateTime.plusDays(1);
    }

    if (!leaveReqCalendarWeek.getDays().isEmpty()) {
        getWeeks().add(leaveReqCalendarWeek);
    }

}