Skip to content

Commit

Permalink
Bug fixed to start date for intervals two dates option.
Browse files Browse the repository at this point in the history
  • Loading branch information
buglss committed Jun 9, 2022
1 parent 3163668 commit 81648d6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions nodes/inject.js
Expand Up @@ -100,20 +100,23 @@ module.exports = function(RED) {
let crontime = handleCrontabWithCronti(this.crontiMethod, ...JSON.parse(this.crontiArgs))
this.cronjob = scheduleTask(crontime, () => {
if(this.crontiMethod === "onIntervalTime") {
let startDate = new Date(JSON.parse(this.crontiArgs)[0])
let endDate = new Date(JSON.parse(this.crontiArgs)[1])
if(new Date() >= endDate) {
this.cronjob.stop();
delete this.cronjob;
return
} else if(new Date <= startDate) {
return
}
}
node.emit("input", {})
});
let endText = ""
let dateText = ""
if(this.crontiMethod === "onIntervalTime") {
endText = "End:" + new Date(JSON.parse(this.crontiArgs)[1]).toISOString()
dateText = "ST:" + new Date(JSON.parse(this.crontiArgs)[0]).toISOString() + " | ET:" + new Date(JSON.parse(this.crontiArgs)[1]).toISOString()
}
this.status({fill:"green",shape:"dot",text:crontime+" "+endText});
this.status({fill:"green",shape:"dot",text:crontime+" | "+dateText});
}
};

Expand Down

0 comments on commit 81648d6

Please sign in to comment.