daysFromNow
Calculates the date of n
days from today as a string representation.
- Use
new Date()
to get the current date,Math.abs()
andDate.prototype.getDate()
to update the date accordingly and set to the result usingDate.prototype.setDate()
. - Use
Date.prototype.toISOString()
to return a string inyyyy-mm-dd
format.