Get the yesterday from the date (JavaScript's Date object standard).
Install:
npm i yesterdayone
Run:
const yesterday = require('yesterdayone')
yesterday(new Date(), 'dd-mm-yyyy') // '03-05-2018'
yesterday('2018-05-04T18:31:17.594Z', 'yyyy-mm-dd') // '2018-05-03'
yesterday('2018-05-04T22:20:20', 'dd/mm/yyyy') // '03/05/2018'
yesterday('Tue 01-01-2009 6:00', 'dd/mm/yyyy') // '31/12/2008'
The MIT License (MIT)
Copyright (c) 2018 marcker