From 2027e07a1f9e6c213d24be90d2a9534246a3bb06 Mon Sep 17 00:00:00 2001 From: David Wu Date: Tue, 26 Dec 2017 17:56:24 +0100 Subject: [PATCH] Create tomorrow.md --- snippets/tomorrow.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 snippets/tomorrow.md diff --git a/snippets/tomorrow.md b/snippets/tomorrow.md new file mode 100644 index 000000000..7203d0ef8 --- /dev/null +++ b/snippets/tomorrow.md @@ -0,0 +1,9 @@ +### tomorrow + +Results in a string representation of tomorrow's date. +Use `new Date()` to get today's date, adding `86400000` of seconds to it(24 hours), using `toISOString` to convert Date object to string. + +```js +const tomorrow = () => new Date(new Date() + 86400000).toISOString().split('T')[0]; +// tomorrow() -> 2017-12-26 +```