I\'d like to get a person\'s age from its birthday. now - birthday / 365 doesn\'t work, because some years have 366 days. I came up with the following code:
now - birthday / 365
Here's my solution which also allows calculating the age at a specific date:
def age on = Date.today (_ = on.year - birthday.year) - (on < birthday.since(_.years) ? 1 : 0) end