digitransit-ui/digitransit-util/packages/digitransit-util-day-range-allowed-diff
2024-02-08 16:19:51 +02:00
..
CHANGELOG.md Remove conventional commit check 2024-02-08 16:19:51 +02:00
index.js feat: initial version 2020-02-26 08:52:58 +02:00
LICENSE-AGPL.txt feat: initial version 2020-02-26 08:52:58 +02:00
LICENSE-EUPL.txt feat: initial version 2020-02-26 08:52:58 +02:00
package.json chore: versioning 2020-12-10 14:17:50 +02:00
README.md feat: initial version 2020-02-26 08:52:58 +02:00
test.js chore: autofix linter errors 2024-01-08 14:15:33 +02:00

@digitransit-util/digitransit-util-day-range-allowed-diff

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 Array of all pattern's unique active dates as Day Of Week (ISO) (e.g. 5,6 = only Friday and Saturday)
  • currentDayNumber number Current date's Day Of Week (ISO) (e.g. 3 = Wednesday)

Examples

digitransit-util.dayRangeAllowedDiff([5,6,5,6,5,6], 3);
//=2

Returns number Allowed diff days between current day and next service day


This module is part of the Digitransit-ui project. It is maintained in the HSLdevcom/digitransit-ui repository, where you can create PRs and issues.

Installation

Install this module individually:

$ npm install @digitransit-util/digitransit-util-day-range-allowed-diff

Or install the Digitransit-util module that includes it as a function:

$ npm install @digitransit-util/digitransit-util