I just working on a simple Ruby on Rails application that keeps the data information of staff, but I realized that I needed a way to check that the date of employment will definitely need to be the beginning of the date of resignation.
<div class="field">
<%= f.label :date_of_employment %><br />
<%= f.date_select :date_of_employment, :start_year =>1990 %>
</div>
<div class="field">
<%= f.label :date_of_resignation %><br />
<%= date_select :date_of_resignation, :start_year => Time.now %>
You should check validates timeliness gem, if you are happy to add outside code to your project. It adds all kinds of time/date based validations.
Including validating that one field is before/after another. For instance, the following commands could be used in you model:
This gem doesn’t rely on javascript to work, it’s pure Ruby.