The date is sent from backend in this format:
"2022-01-01T00:00:00.00000"
How to display date without hours/minutes/seconds like this:
2022-01-01?
On my .tsx component I have InputDatepicker:
<InputDatepicker
label="Training date"
value={trainingData?.trainingDate || ''}
/>
CodePudding user response:
You can get the first element of the result of split, like this:
console.log("2022-01-01T00:00:00.00000".split('T')[0]);
CodePudding user response:
Simple
new Date('2022-01-01T00:00:00.00000').toLocaleDateString('en-CA');
CodePudding user response:
var todayDate = new Date('2022-01-01T00:00:00.00000').toISOString().slice(0, 10);
console.log(todayDate);
CodePudding user response:
const newDate = date.slice(0, 10);