[pickers] Is there a way to tell DatePicker how to initialize a new Date on first select? #15011
Labels
component: pickers
This is the name of the generic UI component, not the React module!
support: commercial
Support request from paid users
support: pro standard
Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/
The problem in depth
Hi,
We're trying to use the MUI-X DatePicker so, that the UI (aka. local) date matches the ISO date but we're having trouble whenever we can't provide an initial
defaultDate
orvalue
as the DatePicker will initialise a new Date itself and we're then unable to tell the datepicker how the date should be initialized.This results in us having to manually parse and transform the dates after selection which is quite error prone.
Is there a way to tell the date picker how to initialize new dates?
I've tried overwriting the DateFns Adapter and overloading the
date(value)
andparse(value, format)
methods but this didn't work.Here is a reproduction of the issue we're facing in Codesandbox: https://codesandbox.io/p/sandbox/datepicker-timezone-problem-reproduction-rk6cfs?file=%2Fsrc%2FDemo.tsx%3A30%2C9
Thank you for your help.
Your environment
`npx @mui/envinfo`
Search keywords: DatePicker, DateFns, Timezones
Order ID: 68930
The text was updated successfully, but these errors were encountered: