date-holidays-parser
date-holidays-parser copied to clipboard
parsing PT12H truncates end at midnight - is this desired behaviour?
can I please check in order to understand this library - it contains a test with the code:
it('02-06 and if saturday then previous friday if sunday then next monday in 2016', function () {
const fn = new DateFn('02-06 14:00 and if saturday then previous friday 16:45 if sunday then next monday PT12H')
const res = fn.inYear(2016).get()
const exp = [{
date: '2016-02-06 14:00:00',
start: 'sat 2016-02-06 14:00',
end: 'sun 2016-02-07 00:00'
}, {
date: '2016-02-05 16:45:00',
start: 'fri 2016-02-05 16:45',
end: 'sat 2016-02-06 00:00',
substitute: true
}]
assert.deepStrictEqual(fixResult(res), exp)
})
my take on PT12H would be a timespan/duration of 12 hours, in which case the expected end dates should be 'sun 2016-02-07 02:00' and 'sat 2016-02-06 04:45' respectively. Is this test set up correctly?