Date function javascript

Added function for previous day