current date is one date behind is yesterday in javascript code example
Example: 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);