const date = new Date()
const yesterday = date.setDate(date.getDate() - 1)
Though that might not do exactly what you expect since that calculation returns a timestamp 24 hours ago (give or take issues with DST). Depends whether you want to compare against any time yesterday or simply any time over 24 hours ago.
If you need to set yesterday to "00:00" in order to compare against any time yesterday, you could change to something like:
const date = new Date()
const yesterday = date.setDate(date.getDate() - 1)
yesterday.setTime(00,00)