Forum: Ruby on Rails weird time out range problem

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
26ca684555abbdb44f01bd1e165e649b?d=identicon&s=25 Vince W. (vince)
on 2007-06-06 05:31
I've got a basic text field where somebody can enter their birthdate.
I'm using a virtual attribute and all is working fine except if a date
is entered between 38 and 68.

Meaning that 01/01/69 will work fine and is interpreted as 01/01/1969
but 01/01/68 gives me a time out of range error:

/usr/local/lib/ruby/1.8/time.rb:184:in `local'
/usr/local/lib/ruby/1.8/time.rb:184:in `make_time'
/usr/local/lib/ruby/1.8/time.rb:243:in `parse'
app/models/user.rb:30:in `birthdate_string='
app/controllers/users_controller.rb:13:in `create'

Everything outside of 38 and 68 is ok.  Anyone heard of such a thing?

Here's my model:

  def birthdate_string

  def birthdate_string=(birthdate_str)
    self.birthdate = Time.parse(birthdate_str)
     if self.birthdate.year < 1000
        self.birthdate += 1900.years
     elsif self.birthdate.year > 2000
       self.birthdate -= 100.years
This topic is locked and can not be replied to.