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

[DatePicker] Allow for value and valueLink props #7537

Closed
stefanmayer13 opened this issue May 30, 2015 · 5 comments
Closed

[DatePicker] Allow for value and valueLink props #7537

stefanmayer13 opened this issue May 30, 2015 · 5 comments
Labels
component: DatePicker The React component. component: pickers This is the name of the generic UI component, not the React module!

Comments

@stefanmayer13
Copy link

If the defaultDate props change on the DatePicker, the value on the input field stays the same. I already created a PR to fix that issue.

@stefanmayer13
Copy link
Author

I realized that defaultDate prop might not be the best way to change the date from the outside, as it might override a user chosen date. I can't really think of a meaningful usecase where the defaultDate prop might change from the outside and you don't want it to override the inside value, but it might still be confusing. Any suggestions about another way to change the displayed value from the outside?

@hai-cea
Copy link
Member

hai-cea commented Jun 2, 2015

@stefanmayer13 Have you tried setting the value prop? Also, you could try to use setDate as well.

@stefanmayer13
Copy link
Author

Setting the value has multiple issues:

  • It is not using formatDate (ugly workaround would be to already use the formatDate function outside)
  • It only sets the value of the input field. The date picker date stays the same.
  • It causes the following error after setting a value with the date picker Cannot call TextField.setValue when value or valueLink is defined as a property., because the input field is now controlled.

Using setDate is not really an option if i want to use JSX and props.

@hai-cea hai-cea changed the title [DatePicker] not changing date on defaultDate props change [DatePicker] Allow for value and valueLink props Jun 19, 2015
@JAStanton
Copy link

I think this should be closed since mui/material-ui#1170 was just merged in

@hai-cea
Copy link
Member

hai-cea commented Jul 17, 2015

Thanks @JAStanton - Fixed with mui/material-ui#1170

New issue to make valueLink work here: #7524

@hai-cea hai-cea closed this as completed Jul 17, 2015
@oliviertassinari oliviertassinari added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 25, 2022
@zannager zannager transferred this issue from mui/material-ui Jan 13, 2023
@zannager zannager added component: pickers This is the name of the generic UI component, not the React module! component: DatePicker The React component. and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: DatePicker The React component. component: pickers This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

5 participants