From 4f9076e66e1574538d0913e9e7434dc3a55e29e1 Mon Sep 17 00:00:00 2001 From: 30secondsofcode <30secondsofcode@gmail.com> Date: Fri, 19 Jul 2019 08:25:44 +0000 Subject: [PATCH] Travis build: 1300 --- README.md | 28 ++++++++++++++++++++++++++++ docs/about.html | 1 + docs/adapter.html | 2 +- docs/archive.html | 2 +- docs/browser.html | 2 +- docs/contributing.html | 1 + docs/date.html | 8 +++++++- docs/function.html | 3 ++- docs/glossary.html | 2 +- docs/index.html | 2 +- docs/math.html | 2 +- docs/node.html | 2 +- docs/object.html | 2 +- docs/string.html | 2 +- docs/type.html | 2 +- docs/utility.html | 2 +- snippets/checkProp.md | 1 + 17 files changed, 51 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 94c2385f1..b102d2f61 100644 --- a/README.md +++ b/README.md @@ -252,6 +252,7 @@ _30s.average(1, 2, 3); * [`maxDate`](#maxdate) * [`minDate`](#mindate) * [`tomorrow`](#tomorrow) +* [`yesterday`](#yesterday) @@ -4579,6 +4580,32 @@ tomorrow(); // 2018-10-19 (if current date is 2018-10-18)
[⬆ Back to top](#contents) +### yesterday + +Results in a string representation of yesterday's date. + +Use `new Date()` to get the current date, decrement by one using `Date.getDate()` and set the value to the result using `Date.setDate()`. +Use `Date.prototype.toISOString()` to return a string in `yyyy-mm-dd` format. + +```js +const yesterday = () => { + let t = new Date(); + t.setDate(t.getDate() - 1); + return t.toISOString().split('T')[0]; +}; +``` + +
+Examples + +```js +yesterday(); // 2018-10-17 (if current date is 2018-10-18) +``` + +
+ +
[⬆ Back to top](#contents) + --- @@ -4736,6 +4763,7 @@ const checkProp = (predicate, prop) => obj => !!predicate(obj[prop]); + const lengthIs4 = checkProp(l => l === 4, 'length'); lengthIs4([]); // false lengthIs4([1,2,3,4]); // true diff --git a/docs/about.html b/docs/about.html index 205e32800..87edbc594 100644 --- a/docs/about.html +++ b/docs/about.html @@ -291,6 +291,7 @@
  • maxDate
  • minDate
  • tomorrow
  • +
  • yesterday
  • Function

    Function