Skip to content

Utility for calculating public safety shift schedules.

License

Notifications You must be signed in to change notification settings

StatEngine/shiftly

Repository files navigation

Shiftly Build Status

Utility for calculating common public safety shift schedules.

Installation

Node version: 10.x.x

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.

About

Utility for calculating public safety shift schedules.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published