let today = new Date().toLocaleDateString();
//or function
function getDate()
{
let today = new Date();
let dd = String(today.getDate()).padStart(2, '0');
let mm = String(today.getMonth() + 1).padStart(2, '0'); //janvier = 0
let yyyy = today.getFullYear();
return `${yyyy}-${mm}-${dd}`;
//return dd + '/' + mm + '/' + yyyy; // change form if you need
}