I'm trying to get an if statement true in my javascript. I track the current time with a setInterval(function). In this Interval I compare a planned datetime with the current datetime:
first I checked it with a simple if(date1 == date2) but I found on the internet you should use getTime() (found that here)
I got this now but it still gives a false when the values are equal:
setInterval(function()
{
    console.log("current time: " + currentTime);
    console.log("end production time: " + endProdTimeMachine2);
    console.log(currentTime.getTime() === endProdTimeMachine2.getTime());
    
    if(currentTime.getTime() === endProdTimeMachine2.getTime())
    {
         console.log("I'm in!!!");
    }
},1000);
When I run this code, my console give this as a result:
So what is going wrong? is it something with the interval?
 
     
     
     
    