User:Trevor MacInnis/sandbox/Calendar proposal

From Wikipedia, the free encyclopedia

I've stumbled upon your extremely interesting Template:Current month calendarB and Category:Date math and I have a few questions.

As I understand it Template:MarchCalendar calls Template:MarchCalendar2006 (2006 found by MAGICWORDS) which calls Template:MarchCalendar2006Source directly (no MAGICWORDS).

or:

Template:Calendar calls Template:CalendarSource which calls all the months like Template:MarchCalendar2006Source (2006 by MAGICWORD)

So, I see the usefullness of Template:Calendar and Template:MarchCalendar but after that I think it becomes too much to maintain. There is currently a Template:MarchCalendar2006, 2005, and 2004, and a source template for each March from 2004 to 2025 (I havn't checked but I assume the same is true for all the months). That works out to 12 templates x 21 years = 252 templates (so far) and if someone wants to show a month pre-2004 or post-2006 they have to create (for example) Template:MarchCalendar1894 and Template:MarchCalendar1894Source.

So I guess my question is - Is there a way to streamline this process, perhaps using a Perpetual calendar, to have a set series of templates which can be used in any combination and for any date?

[edit] Relationship tables

The way things currently stand:

Parent Child Grandchild
Template:Calendar Template:CalendarSource
Template:JanuaryCalendar2005Source
Template:FebruaryCalendar2005Source
Template:MarchCalendar2005Source
Template:AprilCalendar2005Source
Template:MayCalendar2005Source
Template:JuneCalendar2005Source
Template:JulyCalendar2005Source
Template:AugustCalendar2005Source
Template:SeptemberCalendar2005Source
Template:OctoberCalendar2005Source
Template:NovemberCalendar2005Source
Template:DecemberCalendar2005Source

So, there are 14 templates used for one year. Parent and Child to start and 12 Grandchild for each year. Therefore, to create a calendar usable for each year in the 20th century would require: 2 + (100 * 12) = 1202\,



And for individual months calendars:

Parent Child Grandchild
Template:MarchCalendar Template:MarchCalendar2006 Template:MarchCalendar2006Source

So, there are two templates used for each month, the Parent template is used only on pages such as March 1 where it is desireable to see the March of whatever year it happens to be. Therefore, a calendar for each month in the 20th century (and a variable calendar) would require: 12 + (100 * 1) = 112\,

Under my proposed changes the relationship would be:

Parent Child Grandchild
Template:Year B
Template:Year B 1
Template:Year B 2
Template:Year B 3
Template:Year B 4
Template:Year B 5
Template:Year B 6
Template:Year B 7
Template:Year B 8
Template:Year B 9
Template:Year B 10
Template:Year B 11
Template:Year B 12 fixit

So, again, there are 14 templates used for one year. Parent and Child to start and 12 Grandchild for each year. But to create a calendar usable for each year in the 20th century would only require: Parent and Child + 14 Grandchild for each month. 2 + (14 * 12) = 170\, A reduction of 1032 template creations for the 21st century because the Grandchild templates are reusable. Template:Year B 1 is good for January 2005, 1994, 2101, etc. See : Common year starting on Saturday.


And for individual months calendars:

Parent Child Grandchild
Template:MarchCalendar Template:MarchCalendar2006 Template:MarchCalendarSourceA

So, again there are two templates used for each month, the first template is used only on pages such as March 1 where it is desireable to see the March of whatever year it happens to be. Therefore, a calendar for each month in the 20th century (and a variable calendar) would require: 12 + (100 * 1) = 112\, No change there.


Put another way. To create two calendars to describe 2001 and 2007 would require the following templates under each style:

Year Calendar Calendar Source January February March-December
2001 Template:Calendar Template:CalendarSource Template:JanuaryCalendar2001Source Template:FebruaryCalendar2001Source Template:MarchCal2001Source - Template:DecCal2001Source
2007 Template:Calendar Template:CalendarSource Template:JanuaryCalendar2007Source Template:FebruaryCalendar2007Source Template:MarchCal2007Source - Template:DecCal2007Source

Total number of distinct templates used: 26 (and the 2001 templates have not yet been created).

Year Calendar Calendar Source January February March-December
2001 Template:Calendar Template:Year G Template:Year G 1 Template:Year G 2 Template:Year G 3 - Template:Year G 12
2007 Template:Calendar Template:Year G Template:Year G 1 Template:Year G 2 Template:Year G 3 - Year G 12


Total number of distinct templates used: 14 (and the 2001 templates have already been created)

[edit] See also