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
var date=new Date(); var date=new Date(date.setDate(date.getDate()-1)); console.log(date);
This will give you same Date format, but not tested for edge case scenarios.