There are very few inconsistencies with Rails, but the very few times it does,
we’re left thinking: “How could they have missed this!”.
One such inconsistency is with
Though it has a myriad of options,
it lacks in some basic ones.
date_select provides users with an option to control the format of the year
being displayed in the select box.
The default select boxes look like this,
year_format option allows us to configure the format in which
the year gets printed out in the select box,
This might seem trivial however, it happens that it is a crucial feature when developing in the Japanese language.
In Japanese culture,
2021-11-29 is usually written like
年 means year,
月 means month,
and 日 means day.
Rails only provides the option for
year_format and a workaround for
configuring months (using the
Rails 7 adds :day_format option to date_select method.
we can now pass the
day_format key to get a date in the desired format.
we feel that this feature is still incomplete without the