Switch all Time.curren.to_date for Date.current, same result but better syntax

This commit is contained in:
Bertocq
2017-06-11 10:40:41 +02:00
parent e14a5b2eaf
commit b79df113cd
5 changed files with 5 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
module Age
def self.in_years(dob, now = Time.current.to_date)
def self.in_years(dob, now = Date.current)
return nil if dob.blank?
# reference: http://stackoverflow.com/questions/819263/get-persons-age-in-ruby#comment21200772_819263
now.year - dob.year - (now.month > dob.month || (now.month == dob.month && now.day >= dob.day) ? 0 : 1)