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 4b5c6f6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 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
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"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",
"email": "niftylettuce@gmail.com"
},
"contributors": [
"BunKat <bill@levelstory.com>",
"Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)"
"Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)",
"yrambler2001 <yrambler2001@gmail.com> (https://yrambler2001.me/)"
],
"dependencies": {},
"devDependencies": {
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 4b5c6f6

Please sign in to comment.