Fix logic of deciding which parser to use
All checks were successful
CI / CI (push) Successful in 1m22s

This commit is contained in:
SileNce5k 2025-05-14 19:06:37 +02:00
parent 24cc4eb26d
commit 17e7aa3dbb
Signed by: SileNce
GPG key ID: B0A142BB4291B204

View file

@ -8,9 +8,9 @@ module.exports = async function (message, args) {
let currentUnixTime = Math.floor(new Date() / 1000); let currentUnixTime = Math.floor(new Date() / 1000);
let timeInSeconds; let timeInSeconds;
if(Date.parse(args[0]) && parseFloat(args[0]).toString() === args[0]){ if(!isNaN(Date.parse(args[0])) && isNaN(parseTime(args[0]))){
timeInSeconds = timeUntil(args[0]); timeInSeconds = timeUntil(args[0]).totalInSeconds;
if(timeUntil.totalInSeconds < 0){ if(timeInSeconds < 0){
return message.channel.send("The date must not be in the past."); return message.channel.send("The date must not be in the past.");
} }
}else { }else {