Travis build: 936
This commit is contained in:
15
README.md
15
README.md
@ -3,7 +3,7 @@
|
||||
# 30 seconds of code
|
||||
|
||||
[](https://github.com/30-seconds/30-seconds-of-code/blob/master/LICENSE) [](https://www.npmjs.com/package/30-seconds-of-code) [](https://www.npmjs.com/package/30-seconds-of-code) [](https://snyk.io/test/github/30-seconds/30-seconds-of-code?targetFile=package.json) <br/>
|
||||
[](https://travis-ci.com/30-seconds/30-seconds-of-code) [](https://www.codacy.com/app/Chalarangelo/30-seconds-of-code?utm_source=github.com&utm_medium=referral&utm_content=30-seconds/30-seconds-of-code&utm_campaign=Badge_Grade) [](https://codeclimate.com/github/30-seconds/30-seconds-of-code/maintainability) [](https://github.com/Flet/semistandard) <br/>
|
||||
[](https://travis-ci.com/30-seconds/30-seconds-of-code) [](https://www.codacy.com/app/Chalarangelo/30-seconds-of-code?utm_source=github.com&utm_medium=referral&utm_content=30-seconds/30-seconds-of-code&utm_campaign=Badge_Grade) [](https://github.com/Flet/semistandard) <br/>
|
||||
[](https://awesome.re) [](https://www.producthunt.com/posts/30-seconds-of-code) [](https://gitter.im/30-seconds-of-code/Lobby) [](http://makeapullrequest.com)
|
||||
|
||||
> Curated collection of useful JavaScript snippets that you can understand in 30 seconds or less.
|
||||
@ -4491,16 +4491,14 @@ minDate(array); // 2016-01-08T22:00:00.000Z
|
||||
|
||||
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.
|
||||
Use `new Date()` to get the current date, increment 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 tomorrow = (long = false) => {
|
||||
const tomorrow = () => {
|
||||
let t = new Date();
|
||||
t.setDate(t.getDate() + 1);
|
||||
const ret = `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, '0')}-${String(
|
||||
t.getDate()
|
||||
).padStart(2, '0')}`;
|
||||
return !long ? ret : `${ret}T00:00:00`;
|
||||
return t.toISOString().split('T')[0];
|
||||
};
|
||||
```
|
||||
|
||||
@ -4508,8 +4506,7 @@ const tomorrow = (long = false) => {
|
||||
<summary>Examples</summary>
|
||||
|
||||
```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)
|
||||
tomorrow(); // 2018-10-18 (if current date is 2018-10-18)
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
Reference in New Issue
Block a user