Can someone tell me why this returns 'dob is invalid' when dob is '01/01/1969'?
validates_format_of :dob, :with => /[0-9]{2}.[0-9]{2}.[0-9] {4}/, :message => 'is invalid'
I'm trying to validate a date entred into a form. I suppose there are different ways to accomplish this, and because it doesn't work, I'm going to be using them, but this seems like a basic format that should work.
irb gives me this:
"01/01/2007" =~ /[0-9]{2}.[0-9]{2}.[0-9]{4}/
=> 0
"01/01/2007" =~ %r{[0-9]{2}/[0-9]{2}/[0-9]{4}}
=> 0
"01/01/2007" =~ %r{^[0-9]{2}/[0-9]{2}/[0-9]{4}$}
=> 0
none of these combinations work in validates_format_of.
Ideas? Things to try?
Mike B.