Age of person - ActiveSupport

this will not work?

def age (time)
  return ( - time).years

Justin Ko wrote:

Elad Meidar - wrote:
> this will not work?
> def age (time)
> return ( - time).years
> end

Nope. Can you?

Posted via

This is probably overkill if this is the only unit based math you want
to do but...

gem install ruby-units

require 'ruby-units'
age = 'years'.since(birthday) # where birthday is either a Time,
DateTime, or string of a date

if you install and require the 'Chronic' gem, you can pass all sorts of
funky stuff..

require 'chronic'
'days'.until 'monday' #=> 1.48601 days