<script>

// full date
var today = new Date();
console.log( today );

// today
var date = today.toISOString();
console.log( date.slice(0,10) );

// yesterday
var today = new Date();
var yest_epoch = today.setDate(today.getDate() - 1);
var yest = new Date(yest_epoch);
var y = yest.toISOString();

console.log( y.slice(0,10) );

</script>