class ActiveSupport::TimeWithZone

def advance(options)

Experimental RBS support (using type sampling data from the type_fusion project).

def advance: (Hash options) -> ActiveSupport::TimeWithZone

This signature was generated using 1 sample from 1 application.

now.advance(years: 1) # => Mon, 02 Nov 2015 01:26:28.558049687 EST -05:00
now.advance(months: 1) # => Tue, 02 Dec 2014 01:26:28.558049687 EST -05:00
now.advance(weeks: 1) # => Sun, 09 Nov 2014 01:26:28.558049687 EST -05:00
now.advance(days: 1) # => Mon, 03 Nov 2014 01:26:28.558049687 EST -05:00
now.advance(hours: 1) # => Sun, 02 Nov 2014 01:26:28.558049687 EST -05:00
now.advance(minutes: 1) # => Sun, 02 Nov 2014 01:27:28.558049687 EDT -04:00
now.advance(seconds: 1) # => Sun, 02 Nov 2014 01:26:29.558049687 EDT -04:00
now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.558049687 EDT -04:00
Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'

accuracy when moving across DST boundaries.
days), move forward from #time, otherwise move forward from #utc, for
If advancing by a value of variable length (i.e., years, weeks, months,

:hours, :minutes, :seconds.
:years, :months, :weeks, :days,
The +options+ parameter takes a hash with any of these keys:

new TimeWithZone object.
according to the proleptic Gregorian calendar. The result is returned as a
Uses Date to provide precise Time calculations for years, months, and days
def advance(options)
  # If we're advancing a value of variable length (i.e., years, weeks, months, days), advance from #time,
  # otherwise advance from #utc, for accuracy when moving across DST boundaries
  if options.values_at(:years, :weeks, :months, :days).any?
    method_missing(:advance, options)
  else
    utc.advance(options).in_time_zone(time_zone)
  end
end