Is there any event which can tell user have clicked on “Today” so we can automatically set current time in the time field?
Or when using datetimepicker, I would like to get if just date is selected, and then set time automatically?
So users do not have to click on time field again after clicking today ( may be have option called now? )
onValueChange or onChange does not give value when fired with just date filled in.
I would like to parse the date or time entered by user to automatically include //__ and :
So user can type 03142024 and it will be 03/14/2024 and time if typed 1124 it will be 11:24
For the date picker, you can use the i18n formats to define “shortcut” variants. Simply set your US format as the primary one (“MM/dd/yyyy”) and then the shortcuts as addition ones.
Any idea how to do this in Hilla? I tried to import i18n in index.tsx and set this format there. But i18n does not have any method called setDateFormats.
It shows configure option which only have language
My bad, I oversaw that you posted in the hilla channel.
In JS/TS you can simply redefine the parsing function by modifying the date picker’s i18n object. It has a “parseDate” property, that points to a simple function. You can parse the input string here by yourself using normal javascript (or some lib) and return an object representing the parsed date.
Are you using React? If yes, here is an example how to make custom DatePicker with formatter
My particular use case is slightly different though, but I think it gives great overview of the API nevertheless.
1 Like
We use cookies to serve our customers and website visitors in the best possible way. Cookies are used for the proper functioning of the website and for improving the user experience, monitoring visitor traffic and marketing purposes. By continuing to browse the site, you agree to our use of cookies. You can read more about cookies here.
We use cookies to serve our customers and website visitors in the best possible way. Cookies are used for the proper functioning of the website and for improving the user experience, monitoring visitor traffic and marketing purposes. By continuing to browse the site, you agree to our use of cookies. You can read more about cookies here.