Re: Date problem in model

Luke
Thu, 07 Dec 2006 10:21:06 -0000

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