I am using react js for my form. currently i am loading my date to the text box. but currently its show with different format please check this
<Form.Control
type="text" disabled
size="sm"
placeholder=""
name="termDate"
onChange={handleChange}
value={values.termDate}
/>
I am setting the value using the code given below:
setFieldValue('termDate', dataObj.termDate);
when I use the above code, textbox date load as below.

I need to load this date as 2021-07-07.
How do I format this before loading it to the textbox?
setFieldValue('termDate', dataObj.termDate.split('T')[0]);I do this but might not be the optimal waydataObj.termDate.substr(0, 10)