Quick metaClass addition to get Java 8 LocalDate to play with Groovy ranges
// Requires Groovy 2.3 and Java 8 | |
import java.time.* | |
// Add a next() method | |
LocalDate.metaClass.next = { delegate.plusDays( 1 ) } | |
// Then print the next two weeks worth of dates | |
(LocalDate.now()..LocalDate.now().plusWeeks( 2 )).each { | |
println it | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment