Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

WED Dec 31?? Really??

This site may earn commission on affiliate links.
Same...
IMG_0565.JPG
 
Seems like a potentially easy mistake to make in a programming sense. Since 12/31/14 (one year off) is a Wednesday, this is probably a simple case of using >= instead of > or something like that. Still, this seems a bit odd. The day of the week doesn't depend on what year it is (or where we are within that year), so I don't know why someone would code in a comparison like that in the first place.

Usually the date is stored in a standardized manner, such as "the number of days since 1/1/1900." In VB, for example, day 1 is 12/31/1899, and today (12/31/13) is day 41369. To determine the day of the week, you just need to mod today's date (41369) by 7. For those who don't know, mod (modulus) means to divide and get the remainder. For example, 15/7 = 2 remainder 1, so 15 mod 7 = 1. If you mod today's date by 7, the answer should give you the day of the week.

Since 12/31/1899 (day 1) was a Sunday, this gives you:
1=Sun
2=Mon
3=Tue
4=Wed
5=Thu
6=Fri
0=Sat (because 7/7 is 1, remainder 0)

Today (12/31/13) is 41369, so:
41639 mod 7 = 3 (Tuesday)

I suspect that they correctly calculated the date, but for next year. 12/31/14 is 42004, so:
42004 mod 7 = 4 (Wednesday)

Sorry for the programming lesson. Anyway, to make this kind of mistake (assuming it's triggered only on the last day of the year), there was probably a simple logic error, such as the calculation happening on the wrong side of an If statement, or the wrong operator (> instead of >=) being used.

I would LOVE to examine the code behind this. Too bad it's probably something we'll never see.
 
...The only possible explanation I can think of is that the year got prematurely bumped to 2014.

Yeah, Dec 31st is Wednesday in 2014.

And it is already Wednesday, 2014 (but Jan 1) accross the dateline in places like Australia.
The logic to figure out the day of the week must be 'goofy'. Maybe some sort of universal time translation bug going between date and day.

By the way, I had run into a 'bug' 14 years ago, when trying to one-click record the year 2000 new years eve fireworks show on my Tivo. It tried to go back and record the bit of 'buffer' from the previous year and ended up crashing and rebooting the unit instead of recording the show.