vascofg / react-admin-date-inputs

Date Inputs for react-admin
MIT License
67 stars 81 forks source link

Add ability to type the date (enhancement) #3

Closed afilp closed 5 years ago

afilp commented 6 years ago

In an app where someone has to enter old dates (for example, a birth date at 1976), it is difficult to use just the visual modal form (too many clicks to find the date).

Could you find a way to be able to also type a date?

Please check here a similar implementation: http://react-day-picker.js.org/docs/input

Thx!

vascofg commented 6 years ago

Please refer to Keyboard Input example here: https://material-ui-pickers.firebaseapp.com/demo/datepicker Is this what you need? Something like:

<DateInput source="startDate" label="Start date" options={{ keyboard: true }} />
afilp commented 6 years ago

I just added the option but nothing happened, I cannot type inside the field. This is my code:

    <DateInput 
               label="Arrival Date To"
               source="startDateTo"
               options={{format: 'DD/MM/YYYY', showTodayButton: true, keyboard: true,}}
               alwaysOn
    />
vascofg commented 6 years ago

Ok I will test tomorrow and let you know.

On Mon, 25 Jun 2018, 01:17 afilp, notifications@github.com wrote:

I just added the option but nothing happened, I cannot type inside the field. This is my code:

<DateInput
           label="Arrival Date To"
           source="startDateTo"
           options={{format: 'DD/MM/YYYY', showTodayButton: true, keyboard: true,}}
           alwaysOn
/>

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vascofg/react-admin-date-inputs/issues/3#issuecomment-399800612, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmuSXkaSF0skPcKJ0UKPXEjjyTzgtlyks5uACwFgaJpZM4U1VVL .

afilp commented 6 years ago

Thx!

Not sure if we need to do something with state, as in their example they use their onChange handler. If you can show an example (maybe in the README) on how this can work, that would be great!

vascofg commented 6 years ago

This is fixed in the latest version, please update to 1.0.13. I'm now using material-ui-pickers default TextFieldComponent which has the logic to handle these different modes.

afilp commented 6 years ago

Seems to be fixed indeed. Thanks!

P.S. It has some weird behavior though, when pressing ENTER. It fetches twice, once when it loses the focus and another time when clicking OK in the modal that just opened.

vascofg commented 6 years ago

Not sure, does passing disableOpenOnEnter on options help with that?

vascofg commented 6 years ago

Please check https://github.com/dmtrKovalenko/material-ui-pickers/issues/495 for another possible issue.

afilp commented 6 years ago

@vascofg Thanks! Will you merge their latest master to get the fix here too?

vascofg commented 6 years ago

I've bumped the material-ui-pickers dependency version in 1.0.16, please confirm this is fixed.