Chakra UI DatePicker v2 retains browser time‑zone in returned Date despite locale setting
0 reputation · 07 Nov 2021, 14:16 UTC
The goal is to configure Chakra UI’s DatePicker (v2) so that the value passed to onChange represents a UTC timestamp while the calendar continues to display the date according to the chosen locale (e.g., 'fr-FR'). This would eliminate the need for manual offset conversion in application code and ensure consistent date handling across users in different time zones.
Currently the component returns a Date object set to midnight in the browser’s local time‑zone, and no prop or configuration option exists to alter this behavior. The documentation advises using external libraries such as date‑fns‑tz for zone conversion, but it is unclear whether a built‑in timezone‑aware mode is planned or if an undocumented setting could enable UTC output.
- Is there a supported prop or configuration flag that forces the DatePicker to return UTC dates?
- If not, what is the officially recommended pattern for integrating UTC conversion without bypassing the component’s locale formatting?
- Does the Chakra UI roadmap include a timezone‑aware mode for the DatePicker in an upcoming release?