final ZonedDateTime endDate = startDate.plus(tenor); // Unadjusted date.
// Adjusted to month-end: when start date is last business day of the month, the end date is the last business day of the month.
final boolean isStartDateEOM = (startDate.getMonth() != getAdjustedDate(startDate, 1, calendar).getMonth());
if ((tenor.getDays() == 0) & (endOfMonthRule) & (isStartDateEOM)) {
final BusinessDayConvention preceding = new PrecedingBusinessDayConvention();
return preceding.adjustDate(calendar, endDate.with(TemporalAdjusters.lastDayOfMonth()));
}
return convention.adjustDate(calendar, endDate); // Adjusted by Business day convention
}
/**