Material-ui-pickers: [question] Multiple formats in DatePicker

Created on 29 May 2019  路  5Comments  路  Source: mui-org/material-ui-pickers

Hi!
Is it possible currently to provide multiple date formats for DatePicker?
If it's not, would it be something that you consider implementing?

enhancement

Most helpful comment

This could be implemented by overriding the TextFieldComponent and extend TextField to parse the value for a valid date time then convert it to the format that you use in the DatePicker itself. This seems like an implementation detail for your use-case @jromx, and can already be implemented with the current state of the DatePicker

All 5 comments

What do you mean under multiple formats?

Thanks for your reply.
Now it is possible to pass format property to DatePicker, which is a string.
Let's say we have an user using keyboard to enter value. In this case it is straight forward that this certain format should be used. But this user is also often using copy/paste to enter date value. Then, if this value has different format, it has to be corrected.
I was wondering if it would be possible to provide for example an array of formats that would be accepted by picker.

Right now it is not possible. I will left this issue as feature request. But it will be low-priority

This could be implemented by overriding the TextFieldComponent and extend TextField to parse the value for a valid date time then convert it to the format that you use in the DatePicker itself. This seems like an implementation detail for your use-case @jromx, and can already be implemented with the current state of the DatePicker

@Jkitche Great, thanks for sharing a solution.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Lysander picture Lysander  路  3Comments

brett-patterson picture brett-patterson  路  3Comments

sakulstra picture sakulstra  路  3Comments

dandv picture dandv  路  3Comments

katy6514 picture katy6514  路  3Comments