@beyonk/date-utils
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -66,4 +66,4 @@ import dayjs from 'dayjs/esm' | ||
for (let d = 0 ; d < limit ; d += step) { | ||
current = current.add(step, 'days') | ||
callback(schedule, current) | ||
current = current.add(step, 'days') | ||
} | ||
@@ -70,0 +70,0 @@ |
@@ -35,15 +35,35 @@ import { repeatSchedule, utcDate } from './date-utils.js' | ||
const schedule = {} | ||
const schedule = [] | ||
const dates = repeatSchedule(schedule, from, repetition, (schedule, current) => { | ||
schedule[current.date()] = 'foo' | ||
schedule.push(current.date()) | ||
}) | ||
expect( | ||
Object.keys(dates) | ||
dates | ||
).to.equal( | ||
[ '2', '9', '16', '23' ] | ||
[ 2, 9, 16, 23, 30 ] | ||
) | ||
}) | ||
it('repeats every other day', () => { | ||
const repetition = { | ||
recurrence: 2, | ||
duration: 1, | ||
longevity: 1 | ||
} | ||
const schedule = [] | ||
const dates = repeatSchedule(schedule, from, repetition, (schedule, current) => { | ||
schedule.push(current.date()) | ||
}) | ||
expect( | ||
dates | ||
).to.equal( | ||
[ 2, 4, 6, 8, 10 ] | ||
) | ||
}) | ||
}) | ||
}) |
{ | ||
"name": "@beyonk/date-utils", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Beyonk Date Utils", | ||
@@ -28,3 +28,3 @@ "author": "Antony Jones <aj@desirableobjects.co.uk>", | ||
}, | ||
"gitHead": "06c1f3145bceae61a6d8176454c991914329a230" | ||
"gitHead": "f98650be77073bb081f8800f6ccc6d6c2581d4fe" | ||
} |
4061
123