29 Jun

Bare bones date picker for Merb

I’ve been fooling around with Merb these past few months. Can’t say I’ve created anything of consequence, but along the way I’d written this simple date picker, and thought I’d share it.

Used inside a form_for block, it creates 3 separate drop-downs for year, month, and day from a Time object.

Example:

<% form_for @person %>

  <%= date_control :birthdate, :label => 'Birthdate' %>

<% end %></code

Note: This should be run against Merb 0.9.3.

Edit: Jamie Macey (below) has contributed an updated version for Merb 0.9.4.