diff --git a/README.md b/README.md index b47ab9fce..6c3c68b31 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,9 @@ * [Redirect to URL](#redirect-to-url) * [Scroll to top](#scroll-to-top) +### Date +* [Get days difference between dates](#get-days-difference-between-dates) + ### Function * [Chain asynchronous functions](#chain-asynchronous-functions) * [Curry](#curry) @@ -557,6 +560,18 @@ const scrollToTop = _ => { // scrollToTop() ``` +[⬆ back to top](#table-of-contents) +## Date + +### Get days difference between dates + +Calculate the difference (in days) between to `Date` objects. + +```js +const getDaysDiffBetweenDates = (dateInitial, dateFinal) => (dateFinal - dateInitial) / (1000 * 3600 * 24); +//getDaysDiffBetweenDates(new Date("2017-12-13"), new Date("2017-12-22")) -> 9 +``` + [⬆ back to top](#table-of-contents) ## Function diff --git a/tag_database b/tag_database index 5619a0369..a8d4fa8dd 100644 --- a/tag_database +++ b/tag_database @@ -28,6 +28,7 @@ fill-array:array filter-out-non-unique-values-in-an-array:array flatten-array-up-to-depth:array flatten-array:array +get-days-difference-between-dates:date get-max-value-from-array:array get-min-value-from-array:array get-native-type-of-value:utility