diff --git a/snippets/daysAgo.md b/snippets/daysAgo.md index 23c7d38ec..c29b909e2 100644 --- a/snippets/daysAgo.md +++ b/snippets/daysAgo.md @@ -2,12 +2,13 @@ title: daysAgo tags: date,beginner firstSeen: 2020-10-06T05:35:23+03:00 -lastUpdated: 2020-10-20T11:21:07+03:00 +lastUpdated: 2022-01-30T11:48:07+03:00 --- Calculates the date of `n` days ago 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 diff --git a/snippets/daysFromNow.md b/snippets/daysFromNow.md index 1178ccecd..6c6a913a5 100644 --- a/snippets/daysFromNow.md +++ b/snippets/daysFromNow.md @@ -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