The default `date_select` used in fields presents an accessibility issue, because in generates three select controls but only one label. That means that there are two controls without a label. So we're using a date field instead. This type is field is supported by about 99% of the browsers, and we've already got JavaScript code converting this field to a jQuery UI datepicker in case the browser doesn't support date fields. Note that, since we no longer need to parse the three date fields into one, we can simplify the code in both the models and the tests. Another slight improvement is that, previously, we couldn't restrict the month and day controls in order to set the minimum date, so the maximum selectable date was always the 31st of December of the year set by the minimum age setting. As seen in the component test, now that we use only one field, we can set a specific date as the maximum one.
2 lines
55 B
Plaintext
2 lines
55 B
Plaintext
<%= form.date_field :date_of_birth, **field_options %>
|