diff --git a/actionview/lib/action_view/helpers/date_helper.rb b/actionview/lib/action_view/helpers/date_helper.rb index 1622b9f680dd9148fb235ca0cdf4a9640923fc36..ae993f9aa2052f18be2b9e6955f6cbd2d7d64712 100644 --- a/actionview/lib/action_view/helpers/date_helper.rb +++ b/actionview/lib/action_view/helpers/date_helper.rb @@ -205,6 +205,7 @@ def time_ago_in_words(from_time, options = {}) # * :end_year - Set the end year for the year select. Default is Date.today.year + 5 if # you are creating new record. While editing existing record, :end_year defaults to # the current selected year plus 5. + # * :year_format - Set format of years for year select. Lambda should be passed. # * :discard_day - Set to true if you don't want to show a day select. This includes the day # as a hidden field instead of showing a select field. Also note that this implicitly sets the day to be the # first of the given month in order to not create invalid dates like 31 February. @@ -275,6 +276,9 @@ def time_ago_in_words(from_time, options = {}) # # Generates a date select with custom prompts. # date_select("article", "written_on", prompt: { day: 'Select day', month: 'Select month', year: 'Select year' }) # + # # Generates a date select with custom year format. + # date_select("article", "written_on", year_format: ->(year) { "Heisei #{year - 1988}" }) + # # The selects are prepared for multi-parameter assignment to an Active Record object. # # Note: If the day is not included as an option but the month is, the day will be set to the 1st to ensure that