how to get yesterday's date in javascript code example
Example 1: js yesterday date
var yesterday = new Date((new Date()).valueOf() - 1000*60*60*24);
Example 2: js date of yesterday
let today = new Date();
let yesterday = new Date();
yesterday.setDate(today.getDate() - 1);
console.log('Today: ' + today);
console.log('Yesterday: ' + yesterday);