digitransit-ui/digitransit-util/packages/digitransit-util-day-range-allowed-diff/README.md
2020-02-26 08:52:58 +02:00

49 lines
1.5 KiB
Markdown

# @digitransit-util/digitransit-util-day-range-allowed-diff
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## dayRangeAllowedDiff
Finds the allowed diff days between current day and next active day. The result will be the number from 1 to 7.
### Parameters
- `arrayOfDayNumbers` **[Array][1]** Array of all pattern's unique active dates as Day Of Week (ISO) (e.g. 5,6 = only Friday and Saturday)
- `currentDayNumber` **[number][2]** Current date's Day Of Week (ISO) (e.g. 3 = Wednesday)
### Examples
```javascript
digitransit-util.dayRangeAllowedDiff([5,6,5,6,5,6], 3);
//=2
```
Returns **[number][2]** Allowed diff days between current day and next service day
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the digitransit-util project. -->
---
This module is part of the Digitransit-ui project. It is maintained in the
[HSLdevcom/digitransit-ui](https://github.com/HSLdevcom/digitransit-ui) repository, where you can create
PRs and issues.
### Installation
Install this module individually:
```sh
$ npm install @digitransit-util/digitransit-util-day-range-allowed-diff
```
Or install the Digitransit-util module that includes it as a function:
```sh
$ npm install @digitransit-util/digitransit-util
```