Date problem in model

hi all , i have a strange problem here.i want the date in (mm-dd-yy)
fromat. From the view i am getting the value to the controller function.
But when the date value is passed to the model for validation i come
across a strange thing. if the date entered is greater than 12 ,i get
nil value. it wroks perfectly if it si less than or equal to 12. can
any one plz help me out… thanks in advance.

Jon Thomas wrote:

hi all , i have a strange problem here.i want the date in (mm-dd-yy)
fromat. From the view i am getting the value to the controller function.
But when the date value is passed to the model for validation i come
across a strange thing. if the date entered is greater than 12 ,i get
nil value. it wroks perfectly if it si less than or equal to 12. can
any one plz help me out… thanks in advance.

I had a similar thing when I was working with uk dates (dd-mm-yyyy) if
the date entered can’t be validated by ParseDate then it just returns
nil. You can extend this to modify the validation see here for an
example:

http://source.mihelac.org/articles/2006/09/13/parsing-european-date-format-in-ruby-rails

Cheers
Luke

hi luke,
thank u somuch for the quick reply.i thought of validating the date in
the controller itself as in controller am getting the correct value.