Date Time Text Field Helpers plugin

Plugin details

Apart from possibly the longest plugin name ever, these are a set of form helpers that use text fields instead of select dropdowns the standard Rails date form helpers use. Each date/time component gets its own text field which enables quicker entry using the keyboard while still using the built in Rails multi-parameter field handling.

Something I like about this plugin (coz I wanted the feature) is that it always returns the user entered values when a form is redisplayed. This means that if the user enters garbage or an invalid date (requires date validation with something like validates_date_time plugin), when form is redisplayed the values are as the user entered. This is so they can understand what they stuffed up rather than just blank or a shifted date value which you get when you enter 30th February and have a date in March returned when using date_select. The shifted date is particularly dangerous if the user just clicks save again and doesn't pay attention.

Websitehttp://github.com/adzap/date_time_text_field_helpers Repositorygit://github.com/adzap/date_time_text_field_helpers.git Author Adam Meehan Tags Date, Time LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install git://github.com/adzap/date_time_text_field_helpers.git

== Usage

So instead of:

  date_select :person, :date_of_birth



or

  time_select :person, :time_of_birth



or

  datetime_select :person, :date_and_time_of_birth



use:

  date_text_field :person, :date_of_birth



or

  time_text_field :person, :time_of_birth



or

  datetime_text_field :person, :date_and_time_of_birth



== Options

Most of the options which can be used with the standard Rails date helpers apply including :order, :default, :include_seconds and so on.

A few new options are:

:date_separator - Sets the character displayed between the date components

:time_separator - guess

:date_time_separator - the separator between the date and the time parts

:blank - acts like :include_blank option to use blank fields rather than the default current date/time if the column has no value yet.

Further Documentation

Edit plugin | Back in time (5 older versions) | Last edited by: scott, 10 months ago