Change default date formatter in active admin

berkes picture berkes · Mar 19, 2013 · Viewed 9.1k times · Source

In ActiveAdmin dates are printed in the, supposedly American, format %B %d, %Y %H:%M. E.g. March 19, 2013 13:25

However, my "default" frontend prints this using the default Rails (ISO) format, 2013-03-07 14:12:31 UTC, as seen when dropping a <%= Date.new %> anywhere in a view.

  1. What is defining the format for the ActiveAdmin dates?
  2. Where or how can this be changed, if possible, simply following a global Rails wide i18n setting.

Answer

Fivell picture Fivell · Mar 19, 2013

please, ensure you have next lines in your config/locales/en.yml

en:
  date:
    formats:
      long: "%Y-%m-%d"
  time:
    formats:
      long: "%Y-%m-%d %H:%M:%S"

Also if you want to change Filter default date formats Try this Active Admin date filter date format customisation