Issue
In typescript, in this date-picker, after selecting a date from the calendar, the selected date is outputted in the format dd-mm-yy, is there a way to output the date in the long format(Wednesday 9th March 2022.) This is using the standard datepicker.
<input type="date" onChange={
(event:React.ChangeEvent<HTMLInputElement>) =>{
let newTimesheet = [...timesheet];
newTimesheet[index].date=event.target.value;
setTimesheet(newTimesheet);
}
}/>
Solution
Try this:
setTimesheet(new Intl.DateTimeFormat('en-GB', { dateStyle: 'full' }).format(newTimesheet));
i hope it works!
Answered By - Panken0
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.