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
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
???????????
npm i tw-shift-schedule
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
?????????
t shift = require('tw-shift-schedule')
let schedule = shift.Schedule.fromTime(times, [opts])
?????? times
?????????
[['2018-01-01 08:00:00', '2018-01-01 18:00:00']]
let data = schedule.toString()
? schedule ??????
let schedule = shift.Schedule.load(data)
????? schedule ???
let errorsAndWarnings = shift.validate(schedule, opts)
???????????????
shift.validate.two_week
???????shift.validate.four_week
???????shift.validate.eight_week
???????
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'
??????????????
xxxxxx xxxxxxxxx .....xxxxx .....
x
??????????.
??????????????? lexer
?????????????? lexer.js
?
????????????? #
????
The MIT License