Update daysAgo.md
This commit is contained in:
@ -9,7 +9,7 @@ Returns the date of `n` days ago from today as a string representation.
|
|||||||
- Use `Date.prototype.toISOString()` to return a string in `yyyy-mm-dd` format.
|
- Use `Date.prototype.toISOString()` to return a string in `yyyy-mm-dd` format.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const daysAgo = (n) => {
|
const daysAgo = n => {
|
||||||
let t = new Date();
|
let t = new Date();
|
||||||
t.setDate(t.getDate() - Math.abs(n));
|
t.setDate(t.getDate() - Math.abs(n));
|
||||||
return t.toISOString().split('T')[0];
|
return t.toISOString().split('T')[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user