Computer Upgrade Dates

I cannot figure why this code is not executing. I have been working on this for weeks, but I have yet to get it to execute. Any input would be helpful.

 <!DOCTYPE html>
<html>
<body>

<p id="demo">Computer Upgrade Dates.</p>

<script>
	var today = newDate();
    var UpgradeDay = newDate("January 1, 2022");
    var msPerDay = 24*60*60*1000;
    
    //Here we calculate the additional time for each group
    //Just adding the extra number of days for the group
    //and we get the upgrade date for that group
    
    var additionalTimeForEachGroup = UpgradeDay.getTime() + (10 * msPerDay);
    var timeLeft  (additionalTimeForEachGroup - today.getTime());
    var days = timeLeft/msPerDay;
    var daysLeft Math.floor(days);
    
    document.getElementID ("demo").innerHTML
    	there are only <h4> $(daysLeft) days </h4> until your Computer Upgrade
        
</script>

</body>
</html>

Your post is missing any context or code.

  • I fixed your post.
  • You should run this function on scene load.
  • I removed some code errors

Here is an example I got running. Didn't check your time calculations logic, but it seams to work.
fixedDateCounter.hype.zip (15,4 KB)

1 Like

This doesn't look like the question is related to the HTML5 animation app, Hype. If not then you may want to find a different forum for help.