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

Date picker to control input values from external state #3712

Closed
1 task done
Tracked by #2881
origami-z opened this issue Jul 4, 2024 · 2 comments
Closed
1 task done
Tracked by #2881

Date picker to control input values from external state #3712

origami-z opened this issue Jul 4, 2024 · 2 comments
Assignees
Labels
community For issues that have been raised by folks outside the core Salt team component: date picker type: enhancement 💡 New feature or request

Comments

@origami-z
Copy link
Contributor

Area

UI Components

The problem

Have been trying to integrate @salt-ds/lab DatePicker component with React-Hook-Form.

Below is the implementation for controlled DatePicker with React-Hook-Form.

Point to consider :

  • We wanted to make sure that user is notified about the incorrect format or garbage string, hence we are persisting invalid value in form state.
  • Backend API's are expected to save date fields as string.

https://stackblitz.com/edit/salt-template-emlnbf?file=App.tsx

The solution

Enable startDateStringValue and endDateStringValue to be controlled props in DateInput ?

Alternatives and examples

Are you a JPMorgan Chase & Co. employee?

  • I am an employee of JPMorgan Chase & Co.
@origami-z origami-z added type: enhancement 💡 New feature or request status: awaiting triage Automatically added to new issues. Should be removed once they have been triaged. community For issues that have been raised by folks outside the core Salt team component: date picker labels Jul 4, 2024
@mark-tate mark-tate self-assigned this Jul 8, 2024
@mark-tate
Copy link
Contributor

now part of ongoing date picker work

@origami-z
Copy link
Contributor Author

Input value is controllable now, updated example with lab.52 version.
https://stackblitz.com/edit/salt-template-l4mqoy?file=App.tsx,RHFDatePicker.tsx

This is achievable not, so closing. Left with one minor TS error raised in #4237

@origami-z origami-z removed the status: awaiting triage Automatically added to new issues. Should be removed once they have been triaged. label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community For issues that have been raised by folks outside the core Salt team component: date picker type: enhancement 💡 New feature or request
Projects
Development

No branches or pull requests

2 participants