vascofg / react-admin-date-inputs

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

Are `parse` and `format` supported? #4

Closed afilp closed 6 years ago

afilp commented 6 years ago

I tried to use them but I get an error due to an "undefined" value in parse, as a result of the onBlur function being called without the date parameter:

image

Am I missing something?

Thanks.

vascofg commented 6 years ago

Options can be passed to the picker through the options prop. Available options are defined here: https://material-ui-pickers.firebaseapp.com/demo/datepicker Please refer to the Options prop part of the README: https://github.com/vascofg/react-admin-date-inputs#options-prop where I state this

afilp commented 6 years ago

Ok, I was actually referring to react-admin functions of parse and format, as noted here: https://github.com/marmelab/react-admin/blob/master/UPGRADE.md#dateinput-stores-a-date-string-instead-of-a-date-object

I understand however that this does not apply in your lib? "The value of the <DateInput> used to be a Date object. It's now a String, i.e. a stringified date. "

I see that your dates are now a Date object, like it used to be before?

Thanks for any clarification!

vascofg commented 6 years ago

Indeed those concept don't really apply to this at the moment. The options you should consider are the ones from material-ui-pickers since that's what's used here. Returned dates from the Picker are Date objects, using date-fns@2.0.0-alpha.7 as specified here https://material-ui-pickers.firebaseapp.com/installation.

PS: A pull request to make this more compliant with react-admin would be welcome.

afilp commented 5 years ago

@vascofg Hi! I was wondering if there is something new with this, we wanted to use the parse/format as the data are different in redux-form than in the DatePicker. Thanks!