Details
-
Type:
New Feature
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0-beta-3
-
Fix Version/s: 1.1-rc-3
-
Component/s: groovy-jdk
-
Labels:None
Description
Increment/Decrement operations and ranges on dates, should allow for units other than hours.
counter = date.byWeek()
counter += 10
today.step(nextWeek, Calendar.HOUR, 5)
Some new ideas on this front, triggered by a similar support in Ruby on Rails.
We could create a "duration" notion that could be used on numbers and allow arithmetic with those durations.
def date = new Date()
date + 3.weeks + 1.day + 2.jours + 5.minutes
3.hours.fromNow
2.days.ago
Thread.startIn( 5.minutes ) { ... }
Timer.every( 45.seconds ) { ... }