Skip to content

Commit

Permalink
fix: fixed failing schedule().next() #14
Browse files Browse the repository at this point in the history
  • Loading branch information
yrambler2001 committed Jul 28, 2021
1 parent fe30d9d commit 977b9f8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Assuming you are using [browserify][], [webpack][], [rollup][], or another bundl
| -------------- | -------------------------- |
| **BunKat** | |
| **Nick Baugh** | <http://niftylettuce.com/> |
| **yrambler2001** | <https://yrambler2001.me/> |


## License
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@breejs/later",
"description": "Maintained fork of later. Determine later (or previous) occurrences of recurring schedules",
"version": "4.0.2",
"version": "4.0.3",
"author": "BunKat <bill@levelstory.com>",
"bugs": {
"url": "https://github.com/breejs/later/issues",
Expand Down
8 changes: 6 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -841,9 +841,11 @@ later.compile = function (schedDef) {
function compareFn(dir) {
return dir === 'next'
? function (a, b) {
if (!a || !b) return true;
return a.getTime() > b.getTime();
}
: function (a, b) {
if (!a || !b) return true;
return b.getTime() > a.getTime();
};
}
Expand Down Expand Up @@ -1148,10 +1150,12 @@ later.schedule = function (sched) {
function compareFn(dir) {
return dir === 'next'
? function (a, b) {
return !b || a.getTime() > b.getTime();
if (!a || !b) return true;
return a.getTime() > b.getTime();
}
: function (a, b) {
return !a || b.getTime() > a.getTime();
if (!a || !b) return true;
return b.getTime() > a.getTime();
};
}

Expand Down

0 comments on commit 977b9f8

Please sign in to comment.