Update formatting

This commit is contained in:
Isabelle Viktoria Maciohsek
2022-01-30 11:59:57 +02:00
parent 2081e04694
commit 48790982c1
2 changed files with 6 additions and 4 deletions

View File

@ -2,12 +2,13 @@
title: daysFromNow
tags: date,beginner
firstSeen: 2020-10-09T02:49:17+03:00
lastUpdated: 2020-10-20T11:21:07+03:00
lastUpdated: 2022-01-30T11:48:07+03:00
---
Calculates the date of `n` days from today as a string representation.
- Use `new Date()` to get the current date, `Math.abs()` and `Date.prototype.getDate()` to update the date accordingly and set to the result using `Date.prototype.setDate()`.
- Use the `Date` constructor to get the current date.
- Use `Math.abs()` and `Date.prototype.getDate()` to update the date accordingly and set to the result using `Date.prototype.setDate()`.
- Use `Date.prototype.toISOString()` to return a string in `yyyy-mm-dd` format.
```js