From ef0d41b7a50b7f37cd20dfa1f3f2892e58466afb Mon Sep 17 00:00:00 2001 From: kravorkid Date: Wed, 20 Jul 2022 09:07:43 +0200 Subject: [PATCH] Update is-between.md Add description for each parameters, to improve API doc readability --- docs/plugin/is-between.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/plugin/is-between.md b/docs/plugin/is-between.md index d1031a845..6b7b1ccb5 100644 --- a/docs/plugin/is-between.md +++ b/docs/plugin/is-between.md @@ -4,6 +4,17 @@ title: IsBetween --- IsBetween adds `.isBetween()` API to returns a `boolean` indicating if a date is between two other dates. + +```typescript +.isBetween(startDate: String, endDate: String, precision?: String, inclusion?: String): Boolean +``` +Parameter |Type| Description +---|---|--- +startDate |String| Representing a valid date will be automatically parsed as dayjs date +endDate |String| Representing a valid date will be automatically parsed as dayjs date +precision |String| Granuality offers the precision on start and end inclusive checks. `years`, `month`, `day`... +inclusion |String| String with two characters, offers the precision on start and end inclusive checks '[' means inclusive, '(' mean exclusive... eg: '()' excludes start and end date (default); '[]' includes start and end date; '[)' includes the start date but excludes the stop + ```javascript var isBetween = require('dayjs/plugin/isBetween') dayjs.extend(isBetween) @@ -11,11 +22,6 @@ dayjs.extend(isBetween) // To use `year` granularity pass the third parameter dayjs('2010-10-20').isBetween('2010-10-19', dayjs('2010-10-25'), 'year') -// Parameter 4 is a string with two characters; '[' means inclusive, '(' exclusive -// '()' excludes start and end date (default) -// '[]' includes start and end date -// '[)' includes the start date but excludes the stop -// Granuality offers the precision on start and end inclusive checks. // For example including the start date on day precision you should use 'day' as 3rd parameter. dayjs('2016-10-30').isBetween('2016-01-01', '2016-10-30', 'day', '[)')