Y
Yaxm Yaxm
Hi,
I provide a people search function that a user can specify a age range.
I use acts_as_ferret for the search.
I'd like to represent a user's birth date as a integer number, so that I
can tell Ferret to do the comparision easily.
#calculate birth date based on the given age
def self.birth_date(age)
born = Date.today
Date.new(born.year - age, born.month, born.day)
end
# get the birth date of the user that's 50 years old
User.birth_date(50).to_time
But I got this error:
ArgumentError: argument out of range
from
C:/InstantRails-1.6-win/ruby/lib/ruby/gems/1.8/gems/activesupport-1
4.1/lib/active_support/core_ext/date/conversions.rb:29:in `local'
from
C:/InstantRails-1.6-win/ruby/lib/ruby/gems/1.8/gems/activesupport-1
4.1/lib/active_support/core_ext/date/conversions.rb:29:in `send'
from
C:/InstantRails-1.6-win/ruby/lib/ruby/gems/1.8/gems/activesupport-1
4.1/lib/active_support/core_ext/date/conversions.rb:29:in `to_time'
I think the time can't be before unix epoch
time(http://en.wikipedia.org/wiki/Unix_epoch it is the number of seconds
elapsed since midnight UTC of January 1, 1970, not counting leap
seconds. )
Please advice how I can get around this limitation.
Thanks.
Yaxm
I provide a people search function that a user can specify a age range.
I use acts_as_ferret for the search.
I'd like to represent a user's birth date as a integer number, so that I
can tell Ferret to do the comparision easily.
#calculate birth date based on the given age
def self.birth_date(age)
born = Date.today
Date.new(born.year - age, born.month, born.day)
end
# get the birth date of the user that's 50 years old
User.birth_date(50).to_time
But I got this error:
ArgumentError: argument out of range
from
C:/InstantRails-1.6-win/ruby/lib/ruby/gems/1.8/gems/activesupport-1
4.1/lib/active_support/core_ext/date/conversions.rb:29:in `local'
from
C:/InstantRails-1.6-win/ruby/lib/ruby/gems/1.8/gems/activesupport-1
4.1/lib/active_support/core_ext/date/conversions.rb:29:in `send'
from
C:/InstantRails-1.6-win/ruby/lib/ruby/gems/1.8/gems/activesupport-1
4.1/lib/active_support/core_ext/date/conversions.rb:29:in `to_time'
I think the time can't be before unix epoch
time(http://en.wikipedia.org/wiki/Unix_epoch it is the number of seconds
elapsed since midnight UTC of January 1, 1970, not counting leap
seconds. )
Please advice how I can get around this limitation.
Thanks.
Yaxm