Always use Time.current (aliases internally to Time.zone.now)
Some specs where breaking close to midnight because 30.years.ago uses zone.now and Time.now.utc.to_date doesn't. Also this will make all codebase consistent in the way time is deal with
This commit is contained in:
@@ -50,10 +50,10 @@ class Poll
|
||||
if dob.blank?
|
||||
nil
|
||||
else
|
||||
now = Time.now.utc.to_date
|
||||
now = Time.current.to_date
|
||||
now.year - dob.year - ((now.month > dob.month || (now.month == dob.month && now.day >= dob.day)) ? 0 : 1)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user