I am using date-format package in node back end and I can get today date using
var today = dateFormat(new Date());
In the same
Extract yesterday's date from today
//optimized way
var yesterday = new Date();
yesterday.setDate(yesterday.getDate()-1);
console.log(yesterday) // log yesterday's date
//in-detail way
var today = new Date();
var yesterday = new Date();
yesterday.setDate(today.getDate()-1);
console.log(yesterday) // log yesterday's date