You can use momentjs it is very helpful you can achieve a lot of things with this library.
Get yesterday date with current timing
moment().subtract(1, 'days').toString()
Get yesterday date with a start of the date
moment().subtract(1, 'days').startOf('day').toString()