Need to format this date:
[Wed Jul 03 2019 00:00:00 GMT+0200 (Central European Summer Time), Thu Aug 01 2019 23:59:59 GMT+0200 (Central European Summer Time)]
Into simple mm/dd/yyyy
, but not with moment. Cus moment is to heavy.
This is my format function which get array date = [startDate, endDate]
formatDate = (date) => {
const newDate = new Date(date);
const dateFormatted = [];
for (let i = 0; i < date.length; i++) {
dateFormatted[i] = `${newDate.getMonth() + 1}/${newDate.getDate()}/${newDate.getFullYear()}`;
}
return dateFormatted;
};
As result I am getting this NaN/NaN/NaN
Any suggestion, advice?