@statengine/shiftly

0.0.126 • Public • Published

Shiftly Build Status

Utility for calculating common public safety shift schedules.

Installation

Using npm:

npm install @statengine/shiftly

In Node.js:

const shiftly = require('@statengine/shiftly');

const fairfax = shiftly.fairfaxVA();
fairfax.calculateShift('2017-01-18T09:00:30-0400')
// returns 'C'

Tests

To run the test suite, first install the dependencies, then run npm test:

npm install
npm test

Classes

ShiftInformation

Responsible for calculating individual shift information. The constructor takes an object with the following properties:

pattern: A string where each character represents a distinct shift in the pattern. The pattern repeats indefinitely. For example, ABC would indicate shift A, followed by B, followed by C, and repeat. The pattern is set individually by each department and varies widely in terms of complexity. For example, Los Angeles County FD uses the pattern BABCACABCBCABABCACABCBCA. pattern may also be a comma-delimited string with characters indicating shifts where each collection of characters represents a distinct shift pattern.

firstDay: String represenation of YYYY-MM-DD for the first day corresponding to the provided pattern.

shiftStart: String representation of HHMM for the commencement time of the provided pattern.

timeZone: String indicating the tz database timezone name.

shiftDuration: Number of hours for each shift in the pattern. Default is 24 hour shifts, but may be different under special circumstances such as a Leap Day.

Package Sidebar

Install

npm i @statengine/shiftly

Weekly Downloads

39

Version

0.0.126

License

GPL-3.0

Unpacked Size

150 kB

Total Files

9

Last publish

Collaborators

  • ipsdi_it
  • chopchop
  • adanderson
  • jenkins.statengine
  • tbuffington7