My default Rails time formatters
I've been working on a couple of Rails side projects lately and I've found
myself copying the same initializer to introduce some custom time formats
to use with Time.to_fs
:
This ultimately just lets me remember what these formats are called, and quickly reference them like this:
link_to datetime.to_fs(:human), date_path(date: datetime.to_fs(:ymd))
and get output like this:
<a href="/date/2024-03-31">March 31, 2024</a>