Update daysAgo.md
This commit is contained in:
committed by
GitHub
parent
ce3ded1c1a
commit
1fbbf52a4d
@ -10,9 +10,9 @@ Returns the date of `n` days ago from today as a string representation.
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
const daysAgo = n => {
|
const daysAgo = n => {
|
||||||
let t = new Date();
|
let d = new Date();
|
||||||
t.setDate(t.getDate() - Math.abs(n));
|
d.setDate(d.getDate() - Math.abs(n));
|
||||||
return t.toISOString().split('T')[0];
|
return d.toISOString().split('T')[0];
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user