Created
May 23, 2013 21:01
-
-
Save ThatGuySam/5639391 to your computer and use it in GitHub Desktop.
Just thought I'd post this save someone some time: Auto generates american holidays for the current year for FullCalendar by arshaw
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $year = date('Y'); ?> | |
[ | |
{ | |
start: new Date( <?php echo $year . ', 1-1, 1'; ?> ), | |
url: "http://wikipedia.org/wiki/New_Year%27s_Day" , | |
title: "New Year's Day", | |
allDay: true, | |
category: "Holidays", | |
}, | |
{ | |
start: new Date( <?php echo date('Y ,m-1 ,d', strtotime('january ' . $year . ' third saturday')); ?> ), | |
url: "http://wikipedia.org/wiki/Dr._Martin_Luther_King,_Jr._Day" , | |
title: "Dr. Martin Luther King, Jr. Day" , | |
allDay: true, | |
category: "Holidays", | |
}, | |
{ | |
start: new Date( <?php echo $year . ', 1, 2'; ?> ),//February 2 | |
url: "http://wikipedia.org/wiki/Groundhog_Day" , | |
title: "Groundhog Day", | |
allDay: true, | |
category: "Holidays", | |
}, | |
{ | |
start: new Date( <?php echo $year . ', 1, 14'; ?> ),//February 14 | |
url: "http://wikipedia.org/wiki/Valentine%27s_Day" , | |
title: "Valentine's Day", | |
allDay: true, | |
category: "Holidays", | |
}, | |
//February | |
{ | |
start: new Date( <?php echo date('Y ,m-1 ,d', strtotime('february ' . $year . ' third monday')); ?> ), | |
url: "http://wikipedia.org/wiki/Presidents%27_Day" , | |
title: "Presidents' Day" , | |
allDay: true, | |
category: "Holidays", | |
}, | |
//March | |
{ | |
start: new Date( <?php echo date('Y ,m-1 ,d', strtotime('-1 week', easter_date() ) ); ?> ),//Sunday before Easter | |
url: "http://wikipedia.org/wiki/Palm_Sunday" , | |
title: "Barefoot Sunday", | |
allDay: true, | |
category: "Holidays", | |
}, | |
{ | |
start: new Date( <?php echo date('Y ,m-1 ,d', strtotime('-2 days', easter_date() ) ); ?> ),//The Friday before Easter | |
title: "Good Friday", | |
url: "http://wikipedia.org/wiki/Good_Friday" , | |
allDay: true, | |
category: "Holidays", | |
}, | |
{ | |
start: new Date( <?php echo date('Y ,m-1 ,d', easter_date() ); ?> ),//Don't even ask | |
title: "Easter Sunday", | |
url: "http://wikipedia.org/wiki/Easter", | |
allDay: true, | |
category: "Holidays", | |
}, | |
//April | |
{ | |
start: new Date( <?php echo $year . ', 3, 1'; ?> ),//April 1 | |
url: "http://wikipedia.org/wiki/April_Fools%27_Day" , | |
title: "April Fools' Day", | |
allDay: true, | |
category: "Holidays", | |
}, | |
{ | |
start: new Date( <?php echo date('Y ,m-1 ,d', strtotime('may ' . $year . ' last friday')); ?> ),//Last Friday in April | |
url: "http://wikipedia.org/wiki/Arbor_Day" , | |
title: "Arbor Day", | |
allDay: true, | |
category: "Holidays", | |
}, | |
//May | |
{ | |
start: new Date( <?php echo $year . ', 4, 5'; ?> ),//May 5 | |
url: "http://wikipedia.org/wiki/Cinco_de_Mayo", | |
title: "Cinco de Mayo", | |
allDay: true, | |
category: "Holidays", | |
}, | |
{ | |
start: new Date( <?php echo date('Y ,m-1 ,d', strtotime('may ' . $year . ' second sunday')); ?> ),//Second Sunday in May | |
url: "http://wikipedia.org/wiki/Mother%27s_Day" , | |
title: "Mother's Day", | |
allDay: true, | |
category: "Holidays", | |
}, | |
{ | |
start: new Date( <?php echo date('Y ,m-1 ,d', strtotime('june ' . $year . ' last monday')); ?> ),// wierd error -1 month | |
url: "http://wikipedia.org/wiki/Memorial_Day" , | |
title: "Memorial Day" , | |
allDay: true, | |
category: "Holidays", | |
}, | |
//June | |
{ | |
start: new Date( <?php echo $year . ', 6, 1'; ?> ),//June 1 | |
url: "http://wikipedia.org/wiki/Independence_Day_(US)" , | |
title: "Independence Day" , | |
allDay: true, | |
category: "Holidays", | |
}, | |
{ | |
start: new Date( <?php echo date('Y ,m-1 ,d', strtotime('june ' . $year . ' third sunday')); ?> ),//Third Sunday in June | |
url: "http://wikipedia.org/wiki/Father%27s_Day" , | |
title: "Father's Day", | |
allDay: true, | |
category: "Holidays", | |
}, | |
//September | |
{ | |
start: new Date( <?php echo date('Y ,m-1 ,d', strtotime('september ' . $year . ' first monday')); ?> ),//First Monday in September | |
url: "http://wikipedia.org/wiki/Labor_Day" , | |
title: "Labor Day", | |
allDay: true, | |
category: "Holidays", | |
}, | |
//October | |
{ | |
start: new Date( <?php echo date('Y ,m-1 ,d', strtotime('october ' . $year . ' second monday')); ?> ),//Second Monday in October | |
url: "http://wikipedia.org/wiki/Columbus_Day" , | |
title: "Columbus Day", | |
allDay: true, | |
category: "Holidays", | |
}, | |
{ | |
start: new Date( <?php echo $year . ', 11-1, 11'; ?> ),//October 31 | |
url: "http://wikipedia.org/wiki/Halloween" , | |
title: "Halloween", | |
}, | |
//November | |
{ | |
start: new Date( <?php echo $year . ', 11-1, 11'; ?> ),//November 11 | |
url: "http://wikipedia.org/wiki/Veterans_Day", | |
title: "Veterans Day", | |
allDay: true, | |
category: "Holidays", | |
}, | |
{ | |
start: new Date( <?php echo date('Y ,m-1 ,d', strtotime('november ' . $year . ' fourth thursday')); ?> ),//Fourth Thursday in November | |
url: "http://wikipedia.org/wiki/Thanksgiving_(United_States)" , | |
title: "Thanksgiving Day", | |
allDay: true, | |
category: "Holidays", | |
}, | |
//December | |
{ | |
start: new Date( <?php echo $year . ', 12-1, 25'; ?> ),//December 25 | |
url: "http://wikipedia.org/wiki/Christmas" , | |
title: "Christmas", | |
allDay: true, | |
category: "Holidays", | |
}, | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment