Javascript Calendar

Facts about the Calendar module

Displays dates from january 1, 1900 to december 31, 2199
Has an advanced feature to handle feast days (see below)
Select which day the week starts with and which one will be the religious day of the week (where even the style can be changed using CSS).
Hide or view the moon phases, and week numbers (also change the style).
Change the style on all parts of the calendar through CSS.

Calendar module parameters

Calendar

Moonphase
Hide or View the moonphases in the calendar
Weeknumbers
Hidden Weeknumbers are hidden in the calendar
ISO 8601 See Afterword at the end of this table
Week 1 begins on January 1 Week 1 always begins at january 1
Startday of week
Sunday till saturday Select the day that shall be shown first in the calendar
Religious day of the week
None or sunday till saturday Select which day of the week that is religious

Feastdays

View
Select Yes to view or No to hide feast days
Languagedependent feast days

If Yes is selected and the site is multilingual the feast days are displayed depending on the site language, No means that the selected file containing feastday data below is always used

Select a file
Select a file containing feastday data

Flag image

Images are saved in the folder images in the module folder named:
flag_language parameter.gif
where language parameter is eg sv-SE if it is shown
on a site with Swedish as choosen language or en-GB in an English.
This assumes that the parameter Languagedependent flag image is set to Yes,
and that the site is multilingual.
View
Select Yes to view or No to hide flag image
Languagedependent flag image
If Yes is selected and the site is multilingual the flag image is selected depending on the site language, No means that the choosen flag iamge below is always used
Select a Flag image
The flag image that will be shown is dependent of the above setting languagedependent flag image

Module Style

Change hole calendar style with CSS code
Restore CSS parameters to default value
With CTRL-A, mark the textbox, press DEL then click on Save

Code for Feast Days

How to create a file with feast days

Every row of code is placed on a single row in the file wich name should be feastday_languageparameter.txt where languageparameter is eg sv-SE or en-GB to view the file when the site appears in swedish or english

The file is placed in the folder feastdays in the modulefolder

The filestructure

Each line in the file is an instruction for the feast days or public holidays with five parameters, separated by commas

Variables

ww SUN/MON/TUE/WED/THU/FRI/SAT/SUN
mn JAN/FEB/MAR/APR/MAY/JUN/JUL/AUG/SEP/OCT/NOV/DEC
ff FIRST/SECOND/THIRD/LAST
yy Year with FOUR numbers
dd Day (1-31)
mm Month (1-12)
nn Positive or negative number
IN in
DAYS FROM EASTERDAY Days before, after or 0 for the Easter Sunday
EVERY nn YEAR FROM yy TO yy Every n:th year from year TO year, TO is optional
To create a new line (the HTML tag <br />) use space &space

Parameters

The 1st parameter
The date of the feast day

ff ww IN mn Find out when a week day falls on a certain time in a month
ww FROM dd mn Find out when a week day falls from a specified day and month
nn DAYS FROM
EASTERDAY
Find a date falling a specified number of days before/after Easter Sunday
mm-dd A specific month and day

The 2nd parameter
The name of the feast day

Enter a name to appear for the feast day when it occurs

The 3rd parameter
Type of feast day

0 = Not a holiday, 1 = holiday, 2 = Appears with a smaller font size

The 4th parameter
Show/hide flag

1 = Flagday, 0 = Not a flagday

The 5th parameter
Specifies whether the Feast Day to be displayed

1 = Dispalyed, 0 = Not displayed, EVERY nn YEAR FROM yy TO yy
Mostly used with Year limitation below

Year limitation
(can be used in all parameters)

yy:value;yy:value Year: value to be displayed from this year; Year: value to be displayed to and including this year
See examples below how it is used

EXAMPELS
The swedish holidays and feast days

Exampel 1
Midsummer in Sweden

It requires three lines of code in the file:
From 1953 Midsummer falls on the first Friday from June 19, the line should not appear before 1953

Line of code:
FREE FROM June 19, Midsommarafton, 0,0,1953:1; 1952:0

Meaning:
Midsummer falls on the first Friday from 19 June, it is called Midsommarafton (Midsummer Eve), 0 = is not a holiday, 0 = not flag day and then the first example of the setting Year limitation described above: after 1953 this day is shown but not before.


Midsummer's Day fall from 1953 on the first Saturday from June 20, before that Midsummer's Day falls on 24 June and is a public holiday and is from 1982 a public flag day but not before and it occurs only from 1925

Line of code:
1953: SAT FROM June 20, 1952:6-24, Midsommardagen, 1,1982:1; 1981:0,1925:1; 1924:0

Meaning:
I get great help from the Year limitation above becuase from 1953 falls Midsummer's Day on the Saturday that falls from 20 June, 1952 and earlier this day fall on 24 June (6-24 above), the day is called Midsommardagen (Midsummer's Day), 1 = is a public holiday, public flag day from 1982 but not before that and it is displayed from 1925 but not before that.


Before 1925 there was only John the Baptist's day wich fell on June 24, after that there were both Midsummer Eve and Midsummer's Day which fell on 23 and 24 June until 1953, but I have dealt with the Midsummer Day through the code above from 1925, but neither the Midsummer Eve from 1925, nor the John the Baptist's day before 1925

Line of code:
1925:6-23; 1924:6-24,1925: Midsommarafton, 1924: Johannes döparens dag, 1925:0; 1924:1,0,1953:0; 1952:1

Meaning:
Year limitation help me to indicate that from 1925 the day fall in June 23 (6-23 above), before that it fall on the 24 (6-24), from 1925 is it called Midsommarafton (Midsummer Eve), before that Johannes döparens dag (John the Baptist's day), it is a public holiday up to 1924, is not a flag day and is only shown until 1952

Exampel 2
Swedish Election

From 1930 to 1970 parliamentary elections were held every four years

Line of code:
SECOND SUN IN SEP,Riksdagsval,2,0,EVERY 4 YEAR FROM 1930 TO 1970

Meaning:
Falls on the second sunday in september, the day is called Riksdagsval (Parliamentary election), the number 2 specifys that the day is displayed with a smaller fontsize, 0=is not a flagday and is displayed every fourth year between 1930 and 1970.

From 1973 to 1994 parliamentary elections were held every three years

Line of code:
SECOND SUN IN SEP,Riksdagsval,2,1982:1;1981:0,EVERY 3 YEAR FROM 1973 TO 1994

Meaning:
Occurs on the second sunday in September, the day is called Riksdagsval (Parliamentary election), the number 2 indicates that the date appears in smaller letters, it is a flag day from 1982 but not before that and it appear every three years between 1973 and 1994.

From 1998 onwards it is parliamentary election every four years

line of code:
SECOND SUN IN SEP,Riksdagsval,2,1982:1;1981:0,EVERY 4 YEAR FROM 1998

Meaning:
Occurs on the second Sunday in September, the day is called General Election, the number 2 indicates that the date appears in smaller letters, is a flag day in 1982 but not before, and appear every four years from 1998.

Exampel 3
Easterday and days before/after
Easterday

Here I show the code for the Easterday:

0 DAYS FROM EASTERDAY,Påskdagen,1,1983:1;1982:0,1

Meaning:
Falls, of course, 0 days from Easter Sunday, the day is called Påskdagen (Easterday), 1 = is a public holiday, flag day from 1983 but not before and is always displayed

Good friday falls two days before Easterday.

Line of code:
-2 DAYS FROM EASTERDAY,Långfredag,1,0,1

Meaning:
Falls -2 days before Easter Sunday, is called Good Friday, 1 = is a public holiday, 0 = is not a flag day and is always displayed.

Ascension Day falls 39 days after Easterday.

Line of code:
39 DAYS FROM EASTERDAY,Kristi Himmelfärdsdag,1,0,1

Meaning:
Falls 39 days from Easterday, it si called Kristi Himmelfärdsdag (Ascension Day), 1=is a public holiday, 0=is not a flagday and is always displayed.

Exampel 4
Feast Day falls on the same day and month each year

Christmas Eve is a simple exampel:

12-24,Julafton,0,0,1

Meaning:
Falls on december 24 (12-24 above), it is called Julafton (Christmas Eve), 0=it is not a public holiday, 0=it is not a flagday and is always displayed.

Afterword

A few words about how ISO 8601 affects week numbers, which will apply from 1 januri 1973
This standard means that the start day of the week will be Monday and week 1 is the week containing the first Thursday of the year, which means that January 4th is always in Week 1.

An extra week, 53, will be added if week 52 ends before December 28. This means that January 1 is not always week 1 but week 52 or 53 can move to the new year.

Before 1973 a biblical view on the week was used which started with Sunday and was ended with Saturday. Week 1 always fell on January 1 and the year ended with week 53 if week 52 was ended before December 31, this means that the December 31 in some years, eg 1972, would be week 54
All knowledge about dates and weeks are primarily taken from Wikipedia.
Copyright (C) 2011 Christer Toivonen. All rights reserved.

Additional information