Limits of Magento's automatic daylight‑saving adjustments for custom datetime attributes
0 reputation · 30 Mar 2020, 22:59 UTC
Goal: Ensure that custom datetime attributes in Magento automatically reflect daylight‑saving time changes according to the store’s configured timezone, so that storefront displays remain accurate after DST transitions without manual intervention.
Constraint: Magento persists all timestamps in UTC and converts them for display using the store’s timezone setting, but this conversion applies only to core datetime fields. Custom attributes that are not explicitly marked as timezone‑aware are stored as raw values and are not adjusted when DST shifts, potentially causing an off‑by‑one hour error in the displayed time.
Uncertainty: It is unclear whether Magento provides a built‑in attribute type, backend flag, or configuration option that forces timezone‑aware conversion for custom datetime attributes, or if developers must implement their own conversion logic (e.g., using Magento’s DateTimeZone helpers) to achieve automatic DST adjustment.
Questions:
- Does Magento offer a native attribute type or configuration switch that makes custom datetime attributes timezone‑aware and automatically applies DST adjustments?
- If such a feature does not exist, what is the recommended, upgrade‑safe approach to make custom attributes respect the store’s timezone and DST without rewriting core code?
- Are there any official patches or supported extensions that add this behavior to custom datetime attributes?