Utility for calculating common public safety shift schedules.
npm install @statengine/shiftly
const shiftly = require('@statengine/shiftly'); const fairfax = shiftly.fairfaxVA(); fairfax.calculateShift('2017-01-18T09:00:30-0400') // returns 'C'
To run the test suite, first install the dependencies, then run
npm install npm test
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,
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
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
shiftStart: String representation of
HHMM for the commencement time of the provided
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.