From 8c42f47d593d2d4b3937fb4724d6409e270e6d6f Mon Sep 17 00:00:00 2001 From: 30secondsofcode <30secondsofcode@gmail.com> Date: Mon, 26 Feb 2018 10:18:18 +0000 Subject: [PATCH] Travis build: 1736 --- README.md | 6 ++++-- docs/index.html | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 812f7c70e..6053c1753 100644 --- a/README.md +++ b/README.md @@ -3761,12 +3761,13 @@ Results in a string representation of tomorrow's date. Use `new Date()` to get today's date, adding one day using `Date.getDate()` and `Date.setDate()`, and converting the Date object to a string. ```js -const tomorrow = () => { +const tomorrow = (long = false) => { let t = new Date(); t.setDate(t.getDate() + 1); - return `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, '0')}-${String( + const ret = `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, '0')}-${String( t.getDate() ).padStart(2, '0')}`; + return !long ? ret : `${ret}T00:00:00`; }; ``` @@ -3775,6 +3776,7 @@ const tomorrow = () => { ```js tomorrow(); // 2017-12-27 (if current date is 2017-12-26) +tomorrow(true); // 2017-12-27T00:00:00 (if current date is 2017-12-26) ``` diff --git a/docs/index.html b/docs/index.html index c214aacdb..86831a0ac 100644 --- a/docs/index.html +++ b/docs/index.html @@ -839,14 +839,16 @@ document.bodygetMeridiemSuffixOfInteger(11); // "11am" getMeridiemSuffixOfInteger(13); // "1pm" getMeridiemSuffixOfInteger(25); // "1pm" -

tomorrow

Results in a string representation of tomorrow's date. Use new Date() to get today's date, adding one day using Date.getDate() and Date.setDate(), and converting the Date object to a string.

const tomorrow = () => {
+

tomorrow

Results in a string representation of tomorrow's date. Use new Date() to get today's date, adding one day using Date.getDate() and Date.setDate(), and converting the Date object to a string.

const tomorrow = (long = false) => {
   let t = new Date();
   t.setDate(t.getDate() + 1);
-  return `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, '0')}-${String(
+  const ret = `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, '0')}-${String(
     t.getDate()
-  ).padStart(2, '0')}`;
+  ).padStart(2, '0')}`;
+  return !long ? ret : `${ret}T00:00:00`;
 };
 
tomorrow(); // 2017-12-27 (if current date is 2017-12-26)
+tomorrow(true); // 2017-12-27T00:00:00 (if current date is 2017-12-26)
 

Function

attempt

Attempts to invoke a function with the provided arguments, returning either the result or the caught error object.

Use a try... catch block to return either the result of the function or an appropriate error.

const attempt = (fn, ...args) => {
   try {
     return fn(args);