One way to do it:
var d = new Date();
d.setDate(d.getDate()-1);
logInfo("Yesterdays date was: " + d.toLocaleString());
Output:
09/04/2020 13:24:33 js Yesterdays date was: Wed Apr 8 13:24:33 2020
Depending on what you need, you can refine the date format further using Javascript