g0v/tw-shift-schedule

Name: tw-shift-schedule

Owner: g0v

Description: ?????

Created: 2018-01-14 09:49:25.0

Updated: 2018-05-23 20:56:47.0

Pushed: 2018-05-23 20:56:45.0

Homepage: null

Size: 129

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

?????

JavaScript Style Guide Build Status

???????????

npm i tw-shift-schedule

Usage
t shift = require('tw-shift-schedule')

???????? from https://www.twreporter.org/a/death-of-taiwan-rail-train-conductor
schedule = shift.Schedule.fromTime([
2017-12-01 09:36:00', '2017-12-01 19:44:00'],
2017-12-02 05:30:00', '2017-12-02 10:14:00'],
2017-12-04 16:16:00', '2017-12-04 21:04:00'],
2017-12-05 07:36:00', '2017-12-05 13:15:00'],
2017-12-07 10:37:00', '2017-12-07 16:11:00'],
2017-12-08 13:50:00', '2017-12-08 23:58:00'],
2017-12-09 08:18:00', '2017-12-09 09:19:00'],
2017-12-11 10:00:00', '2017-12-11 18:24:00'],
2017-12-12 18:27:00', '2017-12-12 22:16:00'],
2017-12-13 07:02:00', '2017-12-13 11:20:00'],
2017-12-14 12:29:00', '2017-12-14 22:58:00'],
2017-12-15 05:25:00', '2017-12-15 08:17:00'],
2017-12-17 15:40:00', '2017-12-18 00:26:00'],
2017-12-18 07:35:00', '2017-12-18 10:09:00'],
2017-12-19 16:16:00', '2017-12-19 21:04:00'],
2017-12-20 07:40:00', '2017-12-20 13:15:00'],
2017-12-21 13:10:00', '2017-12-21 23:23:00'],
2017-12-22 09:00:00', '2017-12-22 09:34:00']
oment.ISO_8601)

results = shift.validate(schedule)
ole.log(results) // ????

test ?????????

API
t shift = require('tw-shift-schedule')
let schedule = shift.Schedule.fromTime(times, [opts])

?????? times ?????????

let data = schedule.toString()

? schedule ??????

let schedule = shift.Schedule.load(data)

????? schedule ???

let errorsAndWarnings = shift.validate(schedule, opts)

???????????????

????

ype: 'warning', msg: '????'},
ype: 'error', msg: '????', offset: <??????????????????>, time: <????>}

let causes = shift.overwork.check(schedule)

???????????????????????????????????

shift.overwork.Causes

?????

t Causes = {
regular: '??????',
ngHours: '?????',
ghtShift: '??',
eviousDayOverwork: '????????',
eviousWeekOverwork: '????????',
eviousMonthOvertime: '???????? > 100',
eviousSixMonthsOvertime: '?????????? > 45'

Design

??????????????

xxxxxx xxxxxxxxx .....xxxxx .....

????? lexer ?????????????? lexer.js?

????????????? # ????

License

The MIT License


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.