duetds / date-picker

Duet Date Picker is an open source version of Duet Design System’s accessible date picker. Try live example at https://duetds.github.io/date-picker/
https://www.duetds.com
MIT License
1.73k stars 68 forks source link

Allow customization of valid characters when typing #32

Open wimdeblauwe opened 4 years ago

wimdeblauwe commented 4 years ago

Using the localization support, you can write a custom parse and format function. However, when the format you want to use has a space, the user cannot type that space in the input field.

For example, when using Luxon, one of the default formats is 1 okt. 2020.

Also, suppose the format is dd.mm.yyyy, then maybe you don't want to allow users to type / or - which are currently possible.

Is there maybe a workaround I can use for now to be able to allow the user to use spaces?

wimdeblauwe commented 4 years ago

Thinking out loud: maybe the input can be disabled so the user cannot type manually, but is forced to use the date picker? Is that an option?

arielsalminen commented 4 years ago

@WickyNilliams what are your thoughts on this?

forivall commented 2 years ago

my workaround is to use yarn2+'s patch protocol or patch-package to change the DISALLOWED_CHARACTERS regex. hacky, but works for now.