Module: TimeCrisis::Support::Advance::DateTime
- Defined in:
- lib/time_crisis/support/advance.rb
Instance Method Summary collapse
Instance Method Details
#advance(options) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/time_crisis/support/advance.rb', line 34 def advance() d = to_date.advance() datetime_advanced_by_date = change(:year => d.year, :month => d.month, :day => d.day) seconds_to_advance = ([:seconds] || 0) + ([:minutes] || 0) * 60 + ([:hours] || 0) * 3600 seconds_to_advance == 0 ? datetime_advanced_by_date : datetime_advanced_by_date.since(seconds_to_advance) end |