Skip to content

Commit

Permalink
Swap function parameter ordering for `_checkTimeInSkippedRangeMultiHo…
Browse files Browse the repository at this point in the history
…ur`. Now represents HH:mm (start), HH:mm (end).
  • Loading branch information
GijsvandenHoven authored and intcreator committed Mar 5, 2023
1 parent 576866e commit f5d4ea4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions lib/time.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,10 @@ function CronTime(luxon) {
} else {
// non-round or multi-hour jump. (does not exist in the real world at the time of writing)
return this._checkTimeInSkippedRangeMultiHour(
startingMinute,
afterJumpingPoint.minute,
startingHour,
afterJumpingPoint.hour
startingMinute,
afterJumpingPoint.hour,
afterJumpingPoint.minute
);
}
},
Expand Down Expand Up @@ -571,12 +571,17 @@ function CronTime(luxon) {
*
* If any hour x minute combination is a valid time, true is returned.
* The endMinute x endHour combination is only checked with the 0th second, since the rest would be out of the range.
*
* @param startHour {number}
* @param startMinute {number}
* @param endHour {number}
* @param endMinute {number}
*/
_checkTimeInSkippedRangeMultiHour: function (
startMinute,
endMinute,
startHour,
endHour
startMinute,
endHour,
endMinute
) {
if (startHour >= endHour) {
throw new Error(
Expand Down
2 changes: 1 addition & 1 deletion tests/crontime.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ describe('crontime', () => {
it('Enforces the hour difference assumption for handling multi-hour DST jumps', () => {
const cronTime = new cron.CronTime('30 16 * * *');
expect(() => {
cronTime._checkTimeInSkippedRangeMultiHour(0, 30, 15, 15);
cronTime._checkTimeInSkippedRangeMultiHour(15, 0, 15, 30);
}).toThrow();
});
it('should generate the right N next days for * * * * *', () => {
Expand Down

0 comments on commit f5d4ea4

Please sign in to comment.