title: Explain why Dec 31 2012 is week 53 and not week 1 (ISO-8601)
body: <p>I'm trying to write a function in JavaScript that returns the week number for a given date and I'm testing my code against two functions I've found on the web, i.e.</p>
  
  <pre><code>http://techblog.procurios.nl/k/n618/news/view/33796/14863/calculate-iso-8601-week-and-year-in-javascript.html
  http://www.epoch-calendar.com/support/getting_iso_week.html
  </code></pre>
  
  <p>I've tested 30,000 days starting from Jan 1 1970 and I got a few differences with the second source. The first kind of differences is where that source returns week zero for some cases, which is clearly wrong. Then for some other cases it return week 53, where my function returns week 1. These are the dates</p>
  
  <ul>
  <li>1984, Dec 31</li>
  <li>2012, Dec 31</li>
  <li>2040, Dec 31</li>
  </ul>
  
  <p>And they all look like this</p>
  
  <pre><code>Dec         Jan
  29  30  31  01  02  03  04  05  06  07  08  09  10
  Sa  Su  Mo  Tu  We  Th  Fr  Sa  Su  Mo  Tu  We  Th
          ^^                          ^^
  </code></pre>
  
  <p>according to ISO-8601</p>
  
  <ul>
  <li>weeks start on Monday</li>
  <li>first week of the year is the week with the first Thursday of that year</li>
  </ul>
  
  <p>Jan 3 is the first Thursday of 2013, therefore Jan 3 is a day in week 1 (of 2013). And the start of week 1 (of 2013) is the Monday before that Thursday, which is Dec 31 2012.</p>
  
  <p>Therefore Dec 31 2012 must be week 1.</p>
  
  <p>However...</p>
  
  <ul>
  <li>when I type 'what week is 31 december 2012' in Wolfram Alpha, it returns week 53</li>
  <li>when I type '=WEEKNUM("2012-12-31")' in excel, it also returns week 53</li>
  </ul>
  
  <p>Am I missing something? What bothers me is that it occurs on only so few dates (3 dates in 70 years or more)</p>