use of org.joda.time.Months in project estatio by estatio.
the class InvoiceAttributesVM method getFrequencyElseNull.
private String getFrequencyElseNull() {
final SortedSet<InvoiceItem> items = invoice.getItems();
if (items.isEmpty()) {
return null;
}
final InvoiceItem item = items.first();
final LocalDate startDate = item.getStartDate();
final LocalDate endDate = item.getEndDate();
if (startDate == null || endDate == null) {
return null;
}
Months months = Months.monthsBetween(startDate, endDate.plusDays(1));
switch(months.getMonths()) {
case 12:
return "YEAR";
case 3:
return "QUARTER";
case 1:
return "MONTH";
}
return null;
}
Aggregations