I'm trying to set a date with 4 days range (From: today - 2, To: today + 2).
Today, on 31. august I found the bug in my code, which says Invalid date
.
I'm changing the date like this, and If I console.log()
it, it says -1
.
Any help would be appreciated.
date: Date = new Date();
defaultDay: string = ("0" + (this.date.getDate() - 2)).slice(-2)
P.S: I checked the moment.JS library, but currently I don't have that much time to change the whole project to it.