Created by: nburkley
Currently there's no control over the display format of the DateTimes in Administrate. This pull request adds a format
option to a Field::DateTime
field.
e.g.
created_at: Field::DateTime.with_options(format: :short)
By default, if no option is passed the default
format is used - which is was is done implicitly currently.
Alternatively, formats can be added to the in the local yaml
files and referred to by key
e.g.
en:
date:
formats:
year_only: "%Y"
created_at: Field::DateTime.with_options(format: :year_only)
Format strings can also be used:
created_at: Field::DateTime.with_options(format: "%Y")
I re-used the with_translations
helper to isolate the formats defined in any en.yml
files. I moved it into a module to make it easier to reuse.
Let me know what you think.