mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #18063 from claudiob/remove-as-time-with-zone-since
Replace AS::TimeWithZone#since with alias to +
This commit is contained in:
commit
320f75baaf
1 changed files with 1 additions and 10 deletions
|
@ -276,6 +276,7 @@ module ActiveSupport
|
|||
result.in_time_zone(time_zone)
|
||||
end
|
||||
end
|
||||
alias_method :since, :+
|
||||
|
||||
# Returns a new TimeWithZone object that represents the difference between
|
||||
# the current object's time and the +other+ time.
|
||||
|
@ -304,16 +305,6 @@ module ActiveSupport
|
|||
end
|
||||
end
|
||||
|
||||
def since(other)
|
||||
# If we're adding a Duration of variable length (i.e., years, months, days), move forward from #time,
|
||||
# otherwise move forward from #utc, for accuracy when moving across DST boundaries
|
||||
if duration_of_variable_length?(other)
|
||||
method_missing(:since, other)
|
||||
else
|
||||
utc.since(other).in_time_zone(time_zone)
|
||||
end
|
||||
end
|
||||
|
||||
def ago(other)
|
||||
since(-other)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue