I would like the date to be in YYYY-MM-DD format.
It is said that getFullYear does not exist.
error messages:
Uncaught TypeError:date.getFullYear is not a function
at formatDate
happens
source code:
function formatDate(date){
varmonth=("0"+(date.getMonth()+1)).slice(-2);
vardate=("0" + date.getDate()) .slice(-2);
varformatted=`${date.getFullYear()}-${month}-${date}`.replace(/\n|\r/g, ');
return formatted;
}
vardate=("0"+date.getDate()) .slice(-2);
This is because you have overwritten the date
.
© 2024 OneMinuteCode. All rights reserved.