john wytonsite
Coder
JavaScript:
(function(){
var linebreak = true, // should line break be added after date and holidays (if any) (true/false)
calendar = new Date(), day = calendar.getDay(), month = calendar.getMonth(), date = calendar.getDate(), year = calendar.getFullYear(),
f = Math.floor, cent = f(year / 100), g = year % 19, k = f((cent - 17) / 25), i = (cent - f(cent / 4) - f((cent - k) / 3) + 19 * g + 15) % 30,
i = i - f(i / 28) * (1 - f(i / 28) * f(29 / (i+1)) * f((21-g) / 11)), j = (year + f(year / 4) + i + 2 - cent + f(cent / 4)) % 7, l = i - j,
emonth = 3 + f((l + 40) / 44), edate = l + 28 - 31 * f((emonth / 4)), gfwmcal = new Date(), adcal = new Date(), cd = 25, gfmonth, dhtml = [],
dayname = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], gfdate, wmmonth, wmdate, admonth, addate,
monthname = ["January","February","March","April","May","June","July","August","September","October","November","December"],
html = [dayname[day], ", ", monthname[month], " ", date < 10? "0" : "", date, ", ", year], thanksdate = new Date();
gfwmcal.setMonth(--emonth);
gfwmcal.setDate(edate - 2);
gfmonth = gfwmcal.getMonth();
gfdate = gfwmcal.getDate();
gfwmcal.setDate(gfdate + 52);
wmmonth = gfwmcal.getMonth();
wmdate = gfwmcal.getDate();
adcal.setMonth(11);
adcal.setDate(cd);
if(adcal.getDay()){cd += (7 - adcal.getDay());}
adcal.setDate(cd - 28);
admonth = adcal.getMonth();
addate = adcal.getDate();
thanksdate.setMonth(10);
thanksdate.setDate(1);
thanksdate = 5 - thanksdate.getDay();
thanksdate += (thanksdate < 1? 28 : 21);
// Easter and Related
if (month === emonth && date === edate) dhtml.push("Easter Sunday (Western)<p></p>");
if (month === gfmonth && date === gfdate) dhtml.push("Good Friday (Western)<p></p>");
if (month === wmmonth && date === wmdate) dhtml.push("Whit Monday<p></p>");
Last edited by a moderator: