31 Jan

Revised date, datetime helpers for Merb 1.x

I’ve expanded on both mine and Jamie Macey’s original date helper code to support Merb 1.x, and added a datetime helper to the mix.

Usage:

<%= form_for @person %>

  <%= date_field :birth_date :label => 'Birthdate' %>

  <%= datetime_field :birth_date_and_time, :label => 'Birthdate and time' %>

<% end =%>

You’ll find the code here, via GitHub. I generally name this file date_field.rb, and stick it in app/helpers.