rails/rails — pull request #13591 by kuldeepaggarwal (2014-01-04 21:42:59+00:00)
Title: `date_select` helper method extension

This PR is inspired by #13552

`<%= f.date_select :dob, { :start_year => 1900 } %>`

When we attempt to create a resource, the year range is `1900 to (Date.today.year + 5)`. But after creation (with `1900 as dob`), when resource is attempted to edit then the year range is rendered as `1900 to (selected year + 5)`. So if choose `dob` to:

1. `1900` then in edit view, year range will be `1900-1905`.
2. `1920` then in edit view, year range will be `1900-1925`.

Now with this PR, the end year will be: `Date.today.year + 5`, i.e. `2019` when `dob` is created either with `1905` or `1920`. Same behaviour is implemented for `start_year`. And there is specially case for `infinity`.