FRC Countdown

FRC Countdown

This is simply a beautified countdown timer for the FIRST Robotics Competition 2013 Kickoff. Check it out.

What It Does

FRC Countdown counts down the months, days, hours, minutes, and seconds until the 2013 FIRST Robotics Competition Kickoff. The unique part of the countdown is the months; I haven’t seen many countdown timers that bother to calculate months.

FRC Countdown screenshot

How It Works

FRC Countdown is hosted on Heroku. Static assets are served using node.js and node-static. The interesting part is the front end, which does the calculations.

FIRST teams are scattered across the globe, but kickoff takes place at 10:30 Eastern Standard Time. Since I’m used the system clock, I needed to account for any time zone differences.

var offset = (future.getTimezoneOffset() - 5 * 60) * 60 * 1000;
future.setTime(future.getTime() + offset);

The other difficulty was correctly calculating months. I didn’t want to cheat and claim all months were 30 days. After a while, I figured out how to do it properly.

var months = (future.getFullYear() - now.getFullYear()) * 12;
months += future.getMonth() - now.getMonth();
if (now.getDate() > future.getDate())
  months--;
now.setFullYear(now.getFullYear() + Math.floor((now.getMonth() + months % 12) / 12));
now.setMonth(now.getMonth() + months % 12);

You can view the full source code on GitHub.

If I made any mistakes or omissions, please let me know. I would also appreciate any feedback.

FRC Countdown