From d62b6db612d5dd28b563c47a36b76750f3e18ec5 Mon Sep 17 00:00:00 2001 From: Davide Fantino <80767709+fantinodavide@users.noreply.github.com> Date: Tue, 20 Sep 2022 21:35:44 +0200 Subject: [PATCH] fixed timerange --- mapvote.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mapvote.js b/mapvote.js index 2db8a34..eec859e 100644 --- a/mapvote.js +++ b/mapvote.js @@ -202,9 +202,10 @@ export default class MapVote extends DiscordBasePlugin { const tfEndSplit = [ parseInt(tf.end.split(':')[ 0 ]), parseInt(tf.end.split(':')[ 1 ]) ]; const tfStart = new Date(0, 0, 0, ...tfStartSplit) - const tfStart2 = new Date(0, 0, 0, 0, 0) + const midnight = new Date(0, 0, 0, 0, 0) const tfEnd = new Date(0, 0, 0, ...tfEndSplit) - return (tfStart <= timeNow && timeNow < tfEnd) || (tfStart > tfEnd && ((tfStart <= timeNow || tfStart2 <= timeNow) && timeNow < tfEnd)) + const tfEnd2 = new Date(0, 0, 0, ...tfEndSplit) + return (tfStart <= timeNow && timeNow < tfEnd) || (tfStart > tfEnd && ((tfStart <= timeNow && timeNow < midnight) || (midnight <= timeNow && timeNow < tfEnd)) } } async checkUpdates(callback) {