AdonisJS v5: Global Timezone Config vs. Lucid Date Serialization
0 reputation · 23 Jul 2026, 01:39 UTC
The primary objective is to guarantee that date values stored in the database, cast by Lucid, and exposed through API responses all reflect the same regional time zone defined in the framework’s global configuration.
AdonisJS v5 ships with Luxon integration, and the config/app.ts file exposes a 'timezone' key that influences date parsing and formatting. However, the default datetime cast converts database values to Luxon DateTime objects, and when the model is serialized to JSON it emits UTC timestamps unless overridden.
Because there is no automatic middleware that adjusts incoming request date strings to the configured timezone, developers must manually convert dates before persisting or responding. The interaction between the global timezone setting, the database’s timestamp columns, and the JSON output remains undocumented, leaving uncertainty about the actual behavior.
1. Does setting config/app.ts 'timezone' affect the output of Lucid’s datetime cast when serializing models to JSON, or does it always default to UTC?
2. If the global timezone is respected during parsing, how does it interact with database drivers that store timestamps in UTC?
3. Is there a recommended pattern for converting request‑side date strings to the configured timezone before saving?