Calculator for Easter Sunday
Matthew Ogden Aug 8, 2005
The JavaScript Source: Math Related: Calculator for Easter Sunday = 2100) c=5; if (a < 2100) c=6; if (a > 2199) alert("you must enter a date between 1583  2199"); if ( a<=1582) alert("you must enter a date between 1583  2199"); s = a/4 var b = Math.floor( s ) ; sn=(b+a+c)/7 var d = Math.floor( sn ) ; sundaynumber = (snd)*7 m =(a*1)+1 g = m/19 var e = Math.floor( g ) ; var goldennumber = (ge)*19; var sundaynumber= Math.round(sundaynumber) ; if(a>2199) sundaynumber=7; if(a<=1582) sundaynumber=7; var goldennumber= Math.round(goldennumber) ; var t1= "April 16April 17April 18April 19April 20April 21April 15" ; var t2= "April 9April 10April 4April 5April 6April 7April 8" ; var t3= "March 26March 27March 28March 29March 30March 24March 25" ; var t4= "April 16April 17April 18April 12April 13April 14April 15" ; var t5= "April 2April 3April 4April 5April 6April 7April 1"; var t6= "April 23April 24April 25April 19April 20April 21April 22" ; var t7= "April 9April 10April 11April 12April 13April 14April 15" ; var t8= "April 2April 3April 4March 29March 30March 31April 1"; var t9= "April 23April 17April 18April 19April 20April 21April 22" ; var t10= "April 9April 10April 11April 12April 6April 7April 8" ; var t11= "March 26March 27March 28March 29March 30March 31April 1" ; var t12= "April 16April 17April 18April 19April 20April 14April 15" ; var t13= "April 9April 3April 4April 5April 6April 7April 8" ; var t14= "March 26March 27March 28March 29March 23March 24March 25" ; var t15= "April 16April 17April 11April 12April 13April 14April 15" ; var t16= "April 2April 3April 4April 5April 6March 31April 1" ; var t17= "April 23April 24April 18April 19April 20April 21April 22" ; var t18= "April 9April 10April 11April 12April 13April 14April 8" ; var t19= "April 2April 3March 28March 29March 30March 31April 1" ; if (goldennumber == 1) chart=t1; if (goldennumber == 2) chart=t2; if (goldennumber == 3) chart=t3; if (goldennumber == 4) chart=t4; if (goldennumber == 5) chart=t5; if (goldennumber == 6) chart=t6; if (goldennumber == 7) chart=t7; if (goldennumber == 8) chart=t8; if (goldennumber == 9) chart=t9; if (goldennumber == 10) chart=t10; if (goldennumber == 11) chart=t11; if (goldennumber == 12) chart=t12; if (goldennumber == 13) chart=t13; if (goldennumber == 14) chart=t14; if (goldennumber == 15) chart=t15; if (goldennumber == 16) chart=t16; if (goldennumber == 17) chart=t17; if (goldennumber == 18) chart=t18; if (goldennumber == 19) chart=t19; if (sundaynumber==0) document.form1.date.value = (chart.substring(0,8) )+", "+a; if (sundaynumber==6) document.form1.date.value = (chart.substring(8,16) )+", "+a; if (sundaynumber==5) document.form1.date.value = (chart.substring(16,24) )+", "+a; if (sundaynumber==4) document.form1.date.value = (chart.substring(24,32) )+", "+a; if (sundaynumber==3) document.form1.date.value = (chart.substring(32,40) )+", "+a; if (sundaynumber==2) document.form1.date.value = (chart.substring(40,48) )+", "+a; if (sundaynumber==1) document.form1.date.value = (chart.substring(48,56) )+", "+a; if(sundaynumber==7) document.form1.date.value = "error"; } // End // >
Use this script to figure out when Easter Sunday will be in a given year. The timing of the holiday depends on the full moon.
Calculator for Easter Sunday
Enter the year you wish to find the day that Easter falls on.
Then click the calculate button.
The JavaScript Source: Math Related: Calculator for Easter Sunday
Simply click inside the window below, use your cursor to highlight the script, and copy (type Controlc or Applec) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Controls or Commands). The script is yours!!!


Leave a Response
(2 comments)Hi Matthew. Excellent work. However, the program fails to calculate Easter 2013. If you persevere, it comes up with the wrong date. Other years appear to be fine. Please advise if you have a correction. Thanks, Rob
Good algorithm, but bottom can be done quite a bit with less text.[br /][br /]1) Instead of 'if(goldennumber == 0)...' write:[br /]eval('chart = t'+goldennumber);[br /][br /]2) create your chart as arrays, in a little different order so that:[br /]document.form1.date.value = chart[sundaynumber];