Given a range, getting all dates within that range in Scala
If you happen to use the Java 1.8 DateTime
API (or its 1.7 backport threeten), then you could write
def between(fromDate: LocalDate, toDate: LocalDate) = {
fromDate.toEpochDay.until(toDate.toEpochDay).map(LocalDate.ofEpochDay)
}
val numberOfDays = Days.daysBetween(from, until).getDays()
for (f<- 0 to numberOfDays) yield from.plusDays(f)