How to change how ActiveAdmin displays time (every time)

前端 未结 3 1842
自闭症患者
自闭症患者 2021-02-05 13:59

Since the default time in the database is in utc, I wanted to be able to still display it in the users correct time. To do this I had to take column :created_at and

3条回答
  •  攒了一身酷
    2021-02-05 14:42

    So for my understanding, you need two things:

    1. Localtime/Timezone

      You can achieve this by set the right timezone of your rails app, the active_admin will pick up that by default. For example, in your rails config file(config/application.rb):

      config.time_zone = 'Eastern Time (US & Canada)'

    2. Default time format

      You can refer this Change default date formatter in active admin

    Good luck~

提交回复
热议问题