jaredpalmer / jaredpalmer/formik
add the date type to the input value property in typescript definition
- Dominant language
- TypeScript
- Stars
- 34.3k
- Forks
- 2.8k
- PR merge metrics
- No merged PRs in 30d
Description
## 🚀 Feature request
I'm creating a form with typescript and I have a date field in the model. I added to the typescirpt model the date field
```
export interface IDiarioEntry {
titolo: string;
contenuto: string;
tags: string;
dtRiferimento: Date;
}
const ValidationSchema = Yup.object().shape({
... dtRiferimento: Yup.date()
// .max(255, "Too Long!")
.required("Required")
});
```
but I have a problem in the input field
```
```
to be able to make it work I have to add ts@ignore, otherwise I receive an error message.
could be added the date type to the supported value types?
### Current Behavior
If I add the in the interface a date field and try to set the value property I receive this error
Overload 1 of 2, '(props: Readonly): Input', gave the following error.
Type 'Date' is not assignable to type 'string | number | string[] | undefined'.
Type 'Date' is not assignable to type 'number'.
if I add //@ts-ignore to suppress the error seems to work fine
### Desired Behavior
To be able to set the date value at the same way of numbers and strings
### Suggested Solution
to add the Date type to the union type that defined the value property
### Who does this impact? Who is this for?
this is for typescript users
Contributor guide
Research direction
Start by locating the TypeScript definition for InputProps and its value property, which currently rejects Date values. Check how the Input component types its value and verify that date inputs accept the requested type without requiring ts-ignore; the issue is done when the reported example type-checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100