salt-ds icon indicating copy to clipboard operation
salt-ds copied to clipboard

Date picker to control input values from external state

Open origami-z opened this issue 7 months ago • 1 comments

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?

  • [X] I am an employee of JPMorgan Chase & Co.

origami-z avatar Jul 04 '24 09:07 origami-z