date_select saves a bit of coding but it allows users to select invalid dates (like 31st Feb). Is there something like: validates_date_format_of :my_input_field or can anyone suggest a neat way of coding this? Thanks - John
John McCreesh wrote:> date_select saves a bit of coding but it allows users to select invalid > dates (like 31st Feb). Is there something like: > > validates_date_format_of :my_input_field > > or can anyone suggest a neat way of coding this? > > Thanks - John > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/railsPersonnaly, I use a method to get the number of days in a month, and then I just "manually" create the date input. That''s a bit "brutal" but it works. The other way is maybe to use a validating method of your own. But the idea is the same. -- Thomas "ange" Riboulet Developer, GNU/Linux & BSD System administrator http://ange.librium.org http://coterie.librium.org
Thomas "ange" Riboulet wrote:> John McCreesh wrote: > >> date_select saves a bit of coding but it allows users to select >> invalid dates (like 31st Feb). Is there something like: >> >> validates_date_format_of :my_input_field >> >> or can anyone suggest a neat way of coding this? >> >> Thanks - John >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > > Personnaly, I use a method to get the number of days in a month, and > then I just "manually" create the date input. That''s a bit "brutal" but > it works. > The other way is maybe to use a validating method of your own. But the > idea is the same.Dumb question, but how do I get at the raw data returned to do some date validation? Thanks - John