How to validate date format in Ruby on Rails
Posted by Sandro Paganotti in
Ruby on Rails -
comments are closed
Have you noticed that there is no validation for date formats in rails? I’ve found this really well made plug-in that let you use expressions such as:
validates_date :date_of_birth
validates_time :time_of_birth
and more complex expressions like:
validates_date :date_of_birth, :before => [:date_of_death, Proc.new { 1.day.from_now_to_date}], :after => '1 Jan 1900'
validates_date :date_of_death, :before => Proc.new { 1.day.from_now.to_date }
Here is the plugin source:
http://svn.viney.net.nz/things/rails/plugins/validates_date_time/
Many thanks to the author: jonathan.viney@gmail.com

