[HOME] [datelab]

Yeartypes[1] in relation to ISO weeknumbers
=================================================
(C) 1999-01-17, Magnus Bodin <magnus@bodin.org>

The #-numbers refers to ISO weeknumbers. What we can say for sure is that
yeartype {3,9,10} results with a week #53. We can also state that yeartypes
{0,1,2,3,7,8,9,10} starts with week #1, yeartypes {6,12} starts with week #52,
and yeartypes {4,11} starts with week #53. The yeartype {5} starts either
with #52 or #53 depending on if the preceeding year is of type {4} or {10}.

+----++-------------------------------     ---------++-------------------
|year||                                             ||
|type|| Year n                                      || Year n+1
+----++---------------------------+---     -----+---++-------------------
|    ||#1                         |#2        #52|#1                      
|  0 ||Mo |Tu |We |Th |Fr |Sa |Su |Mo       |Su |Mo ||Tu |We |Th |Fr |Sa 
+----++---+---+---+---+---+---+---+---     -+---+---++---+---+---+---+---
|    ||#1                     |#2           |#1                          
|  1 ||Tu |We |Th |Fr |Sa |Su |Mo |Tu  ...  |Mo |Tu ||We |Th |Fr |Sa |Su 
+----++---+---+---+---+---+---+---+---     -+---+---++---+---+---+---+---
|    ||#1                 |#2                #1                      |#2 
|  2 ||We |Th |Fr |Sa |Su |Mo |Tu |We  ...  |Tu |We ||Th |Fr |Sa |Su |Mo 
+----++---+---+---+---+---+---+---+---     -+---+---++---+---+---+---+---
|    ||#1             |#2                    #53                 |#1     
|  3 ||Th |Fr |Sa |Su |Mo |Tu |We |Th  ...  |We |Th ||Fr |Sa |Su |Mo |Tu
+----++---+---+---+---+---+---+---+---     -+---+---++---+---+---+---+---
|    ||#53        |#1                        #52             |#1     
|  4 ||Fr |Sa |Su |Mo |Tu |We |Th |Fr  ...  |Th |Fr ||Sa |Su |Mo |Tu
+----++---+---+---+---+---+---+---+---     -+---+---++---+---+---+---+---
|    ||       |#1                            #52         |#1     
|  5 ||Sa |Su |Mo |Tu |We |Th |Fr |Sa  ...  |Fr |Sa ||Su |Mo |Tu
+----++---+---+---+---+---+---+---+---     -+---+---++---+---+---+---+---
|    ||#52|#1                                #52    ||#1     
|  6 ||Su |Mo |Tu |We |Th |Fr |Sa |Su  ...  |Sa |Su ||Mo |Tu |We |
+----++---+---+---+---+---+---+---+---     -+---+---++---+---+---+---+---
|    ||#1                         |#2       |#1                          
|  7 ||Mo |Tu |We |Th |Fr |Sa |Su |Mo  ...  |Mo |Tu ||We |Th |Fr |Sa |Su 
+----++---+---+---+---+---+---+---+---     -+---+---++---+---+---+---+---
|    ||#1                     |#2            #1                      |#2     
|  8 ||Tu |We |Th |Fr |Sa |Su |Mo |Tu  ...  |Tu |We ||Th |Fr |Sa |Su |Mo 
+----++---+---+---+---+---+---+---+---     -+---+---++---+---+---+---+---
|    ||#1                 |#2                #53                 |#1      
|  9 ||We |Th |Fr |Sa |Su |Mo |Tu |We  ...  |We |Th ||Fr |Sa |Su |Mo |Tu
+----++---+---+---+---+---+---+---+---     -+---+---++---+---+---+---+---
|    ||#1             |#2                    #53             |#1     
| 10 ||Th |Fr |Sa |Su |Mo |Tu |We |Th  ...  |Th |Fr ||Sa |Su |Mo |Tu
+----++---+---+---+---+---+---+---+---     -+---+---++---+---+---+---+---
|    ||#53        |#1                        #52         |#1      
| 11 ||Fr |Sa |Su |Mo |Tu |We |Th |Fr  ...  |Fr |Sa ||Su |Mo |Tu
+----++---+---+---+---+---+---+---+---     -+---+---++---+---+---+---+---
|    ||#52    |#1                            #52    ||#1    
| 12 ||Sa |Su |Mo |Tu |We |Th |Fr |Sa  ...  |Sa |Su ||Mo |Tu
+----++---+---+---+---+---+---+---+---     -+---+---++---+---+---+---+---
|    ||#52|#1                                #52|#1
| 13 ||Su |Mo |Tu |We |Th |Fr |Sa |Su  ...  |Su |Mo ||Tu |We |Th |Fr |Sa 
+----++---+---+---+---+---+---+---+---     -+---+---++---+---+---+---+---

--
[1] Our definition of yeartype is a numeric representation of what weekday
    January 1st is and if the year is a leapyear or not. Like this:

    +-------------+-------------------------------------------+
    |  weekday of |                                           |
    |  January  1 | Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su |
    +-------------+-------------------------------------------+
    |year is leap?|                       X  X  X  X  X  X  X |
    +-------------+-------------------------------------------+
    |  yeartype   |  0  1  2  3  4  5  6  7  8  9 10 11 12 13 |
    +-------------+-------------------------------------------+