ThreeTen / threeten-extra

Provides additional date-time classes that complement those in JDK 8
http://www.threeten.org/threeten-extra/
BSD 3-Clause "New" or "Revised" License
387 stars 77 forks source link

Add `Interval.of(duration, end)` to compliment `Interval.of(start, duration)` #294

Closed rtyley closed 9 months ago

rtyley commented 9 months ago

This adds a new Interval.of(duration, end) way of obtaining an Interval - the mirror of the existing method:

Interval.of(start, duration)

...but for easily getting an Interval that ends at a known instant, with a known duration!

This kind of interval is quite often handy in realtime analytics ("give me the last 30 minutes of results").

jodastephen commented 9 months ago

Surprised this wasn't there! thanks