How do you configure UTC timezone as default

Hello. :wave: I’m not sure if this is a ROM or Hanami question but am curious how to set the time zone for all data/time within the application as UTC by default?

Is this something that can be done as follows or needs to be set much lower at the ROM layer?

  class App < Hanami::App
    config.timezone = "UTC"
  end

@bkuhlmann We don’t have such setting, because we didn’t need it so far.

We can consider later when integrating with ROM.

OK, thanks. :bow: Maybe, I should ask this a different way since I’m trying unlearn how Rails does things in favor of the Hanami philosophy. What is the right way to approach this in Hanami if you want to have a consistent timezone for your data? Should I be doing this entirely at the database level or somewhere else? How do I do in this in a manner that is efficient to set once but not tedious to maintain?

To get it working for your app for the time (heh) being, @bkuhlmann, you probably want to put these lines in the prepare phase of the provider setting up rom:

Sequel.database_timezone = :utc
Sequel.application_timezone = :local

I pulled this from an older pre-hanami app of mine. These work because rom-rb uses sequel under the hood. Obviously go check out Sequel’s docs for what these do exactly.

In addition to this, setting the TZ env var would probably help for non-database times.

Ah, I see now. Thanks (and for the reminder on TZ)!