Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onChange always returns string #66

Closed
jbojcic1 opened this issue Dec 29, 2019 · 5 comments
Closed

onChange always returns string #66

jbojcic1 opened this issue Dec 29, 2019 · 5 comments
Assignees
Labels
enhancement New feature or request stale wontfix This will not be worked on

Comments

@jbojcic1
Copy link

Since value can be Date or string would it make sense that onChange returns value in whichever format value was using?

So if I pass date, I get the date back and if I pass string I get the string back.

@wojtekmaj wojtekmaj self-assigned this Dec 29, 2019
@wojtekmaj wojtekmaj added the question Further information is requested label Dec 29, 2019
@wojtekmaj
Copy link
Owner

You can get hour from Date(), but you can't get Date() from hour alone. Hence the string returned.

@jbojcic1
Copy link
Author

jbojcic1 commented Dec 29, 2019

Could it work like in https://material-ui-pickers.dev/ ?

There if you pass date to the time picker as value, in onChange you get another date instance where date is same like in the value you provided while time is set based on the values selected in the time picker.

@jbojcic1
Copy link
Author

In my project I created a wrapper component where I handle formatting and parsing so now my wrapped timepicker can handle Date, timestamp and string. However I needed to add format prop to the component for cases when value is null since then you can't infer which format is needed based on the passed value.

@wojtekmaj
Copy link
Owner

Interesting idea, but not something I'll be looking to implement in the immediate future.

@wojtekmaj wojtekmaj added enhancement New feature or request and removed question Further information is requested labels Dec 30, 2019
@github-actions
Copy link
Contributor

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 14 days.

@github-actions github-actions bot added the stale label Sep 20, 2021
@wojtekmaj wojtekmaj added the wontfix This will not be worked on label Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants