Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

add form helpers for date and time HTML5 input types

#6151

To complement the existing helpers we have for HTML5 input types like email, url, telephone, number, range and search, this patch adds simple helpers with tests for all of the date/time input types:

date, month, week, time, datetime and datetime-local

By virtue of the usual helper support for passing HTML options, you may of course specify the new attributes that these inputs support:

<%= date_field :todo, :due_date, :min => Date.today.rfc3339 %>

Patch is also available on a branch on GitHub for the pull/merge convenience you dig the most :-)

References:

http://diveintohtml5.org/forms.html#type-date
http://www.whatwg.org/specs/web-apps/current-work/multipage/states-...

Reported by Ches Martin · December 11th, 2010 @ 08:04 PM

State: open
Milestone: none
Assigned to: Josh Kalderimis Josh Kalderimis
Importance: Low

Activity

  1. Thomas van der Pol
    Thomas van der Pol

    Patch does what it says on the tin, tests are correct and exhaustive.

    I'd suggest a patch to http://guides.rubyonrails.org/form_helpers.html once this goes through describing the new functionality.

    February 17th, 2011 @ 01:10 PM

  2. Josh Kalderimis
    Josh Kalderimis
    • State changed from new to open
    • Tag changed from formhelper, forms, html5, patch to action_pack, action_view, html5, patch
    • Assigned user set to Josh Kalderimis
    • Importance changed from to Low

    I will look into this tomorrow and test if it applies cleanly, if it does I will follow up with core.

    February 17th, 2011 @ 01:51 PM

  3. Ches Martin
    Ches Martin

    Cool, I can rebase on current master and verify tests if it helps. Also happy to take a look into a doc patch for the Form Helpers guide as Thomas suggested.

    February 17th, 2011 @ 03:18 PM

  4. Josh Kalderimis
    Josh Kalderimis

    Ches, please do, after you have tested it out I will test it. If all goes well, I will push it up the chain.

    Thanks

    February 17th, 2011 @ 03:26 PM

  5. Ches Martin
    Ches Martin

    My GitHub branch linked above is now rebased on current master and the relevant tests pass. Updated patch is attached.

    February 17th, 2011 @ 05:39 PM