ActionView::Helpers::DateHelper
Comparison table
DateHelper helpers come in two kinds: those with a model object and those without. Apart from field_name, default and selected, Rails handles options of the same name the same way in both. In the helpers with a model object, a given field_name is overridden by method. Only the helpers with a model object use default and selected (those without one use the date or datetime argument).
When the object has no value, the helpers with a model object add selected for the current date and time, but not if include_blank or prompt is given. The helpers without one always add selected for the date or datetime argument (none for nil).
| With a model object | Without a model object | <select> elements created |
|---|---|---|
| A combination of year, month, day, etc. | ||
date_ | select_ | Year, month, day |
datetime_ | select_ | Year, month, day, hour, minute (and second with include_seconds: true) |
time_ | select_ | Hour, minute (the year, month and day are hidden <input> elements; and second with include_seconds: true) |
| Just one | ||
| − | select_ | Year |
| − | select_ | Month |
| − | select_ | Day |
| − | select_ | Hour |
| − | select_ | Minute |
| − | select_ | Second |