添加holiday假日到fullcalendar ,Add Holiday Calendars to Full Calendar

如果你使用fullcalendar,添加holiday假日的方法如下:

googleCalendarApiKey : 'PUT-YOUR-GOOGLE-API-HERE', // google api key 

eventSources: [
    {url:'https://www.google.com/calendar/feeds/en.usa#holiday@group.v.calendar.google.com/public/basic',cache:true}, // us holiday
    {url:'https://www.google.com/calendar/feeds/zh.china#holiday@group.v.calendar.google.com/public/basic',cache:true}, // china holiday
    //'https://www.google.com/calendar/feeds/en.christian#holiday@group.v.calendar.google.com/public/basic', // Christian holiday
    {url:BASEPATH + '/get_events',cache:true}, //local
],

你首先必须申请一个google api key,方法点击这里。另外还需要引入一个js文件:gcal.min.js.

更多参考:https://fullcalendar.io/docs/google_calendar/

Full Calendar 我的简单设置如下:

$(document).ready(function () { 
	var date = new Date(),d = date.getDate(),m = date.getMonth(),y = date.getFullYear();
	var calendar = $('#calendar').fullCalendar({
		buttonHtml: {
			prev: '<i class="ace-icon fa fa-chevron-left"></i>',
			next: '<i class="ace-icon fa fa-chevron-right"></i>'
		},
		header: {
			left: 'title',
			center: '',
			right: 'prev,next today'
		},
		googleCalendarApiKey : 'PUT-YOUR-GOOGLE-API-HERE', 
		eventSources: [
	        {url:'https://www.google.com/calendar/feeds/en.usa#holiday@group.v.calendar.google.com/public/basic',cache:true}, // us holiday
	        {url:'https://www.google.com/calendar/feeds/zh.china#holiday@group.v.calendar.google.com/public/basic',cache:true}, // china holiday
	        {url: BASEURL + 'calendar/get_events',cache:true}, //local
		],
		eventClick: function(calEvent, jsEvent, view){ if((!calEvent.url || calEvent.url.indexOf('google.com/calendar/event')<0) && calEvent.id) location=BASEURL+'calendar/firstday/'+moment(calEvent.start).format('YYYY-MM-DD'); },
		editable: true,
		selectable: true,									
		select: function(start, end, jsEvent, view){ location=BASEURL+'calendar/firstday/'+moment(start).format('YYYY-MM-DD'); },
		eventRender: function(event, element, view) {
	         $(element).qtip({ 
	        	content: event.description ? {title:event.title,text:event.description} : event.title,
	        	position: {my:'top center',at:'bottom center'},
				style: 'qtip-dark',
				hide: {when: {event:'mouseout unfocus click'}}
	        });
	    },
	});
});

 

holiday假日, google源在这里:

Australian Holidays en.australian#holiday@group.v.calendar.google.com
Austrian Holidays en.austrian#holiday@group.v.calendar.google.com
Brazilian Holidays en.brazilian#holiday@group.v.calendar.google.com
Canadian Holidays en.canadian#holiday@group.v.calendar.google.com
China Holidays en.china#holiday@group.v.calendar.google.com
Christian Holidays en.christian#holiday@group.v.calendar.google.com
Danish Holidays en.danish#holiday@group.v.calendar.google.com
Dutch Holidays en.dutch#holiday@group.v.calendar.google.com
Finnish Holidays en.finnish#holiday@group.v.calendar.google.com
French Holidays en.french#holiday@group.v.calendar.google.com
German Holidays en.german#holiday@group.v.calendar.google.com
Greek Holidays en.greek#holiday@group.v.calendar.google.com
Hong Kong (C) Holidays en.hong_kong_c#holiday@group.v.calendar.google.com
Hong Kong Holidays en.hong_kong#holiday@group.v.calendar.google.com
Indian Holidays en.indian#holiday@group.v.calendar.google.com
Indonesian Holidays en.indonesian#holiday@group.v.calendar.google.com
Iranian Holidays en.iranian#holiday@group.v.calendar.google.com
Irish Holidays en.irish#holiday@group.v.calendar.google.com
Islamic Holidays en.islamic#holiday@group.v.calendar.google.com
Italian Holidays en.italian#holiday@group.v.calendar.google.com
Japanese Holidays en.japanese#holiday@group.v.calendar.google.com
Jewish Holidays en.jewish#holiday@group.v.calendar.google.com
Malaysian Holidays en.malaysia#holiday@group.v.calendar.google.com
Mexican Holidays en.mexican#holiday@group.v.calendar.google.com
New Zealand Holidays en.new_zealand#holiday@group.v.calendar.google.com
Norwegian Holidays en.norwegian#holiday@group.v.calendar.google.com
Philippines Holidays en.philippines#holiday@group.v.calendar.google.com
Polish Holidays en.polish#holiday@group.v.calendar.google.com
Portuguese Holidays en.portuguese#holiday@group.v.calendar.google.com
Russian Holidays en.russian#holiday@group.v.calendar.google.com
Singapore Holidays en.singapore#holiday@group.v.calendar.google.com
South Africa Holidays en.sa#holiday@group.v.calendar.google.com
South Korean Holidays en.south_korea#holiday@group.v.calendar.google.com
Spain Holidays en.spain#holiday@group.v.calendar.google.com
Swedish Holidays en.swedish#holiday@group.v.calendar.google.com
Taiwan Holidays en.taiwan#holiday@group.v.calendar.google.com
Thai Holidays en.thai#holiday@group.v.calendar.google.com
UK Holidays en.uk#holiday@group.v.calendar.google.com
US Holidays en.usa#holiday@group.v.calendar.google.com
Vietnamese Holidays en.vietnamese#holiday@group.v.calendar.google.com
アイルランドの祝日 ja.irish#holiday@group.v.calendar.google.com
アメリカの祝日 ja.usa#holiday@group.v.calendar.google.com
イギリスの祝日 ja.uk#holiday@group.v.calendar.google.com
イスラム教の祝日 ja.islamic#holiday@group.v.calendar.google.com
イタリアの祝日 ja.italian#holiday@group.v.calendar.google.com
インドの祝日 ja.indian#holiday@group.v.calendar.google.com
インドネシアの祝日 ja.indonesian#holiday@group.v.calendar.google.com
オランダの祝日 ja.dutch#holiday@group.v.calendar.google.com
オーストラリアの祝日 ja.australian#holiday@group.v.calendar.google.com
オーストリアの祝日 ja.austrian#holiday@group.v.calendar.google.com
カナダの祝日 ja.canadian#holiday@group.v.calendar.google.com
キリスト教の祝日 ja.christian#holiday@group.v.calendar.google.com
ギリシャの祝日 ja.greek#holiday@group.v.calendar.google.com
シンガポールの祝日 ja.singapore#holiday@group.v.calendar.google.com
スウェーデンの祝日 ja.swedish#holiday@group.v.calendar.google.com
スペインの祝日 ja.spain#holiday@group.v.calendar.google.com
タイの祝日 ja.thai#holiday@group.v.calendar.google.com
デンマークの祝日 ja.danish#holiday@group.v.calendar.google.com
ドイツの祝日 ja.german#holiday@group.v.calendar.google.com
ニュージーランドの祝日 ja.new_zealand#holiday@group.v.calendar.google.com
ノルウェイの祝日 ja.norwegian#holiday@group.v.calendar.google.com
フィリピンの祝日 ja.philippines#holiday@group.v.calendar.google.com
フィンランドの祝日 ja.finnish#holiday@group.v.calendar.google.com
フランスの祝日 ja.french#holiday@group.v.calendar.google.com
ブラジルの祝日 ja.brazilian#holiday@group.v.calendar.google.com
ベトナムの祝日 ja.vietnamese#holiday@group.v.calendar.google.com
ポルトガルの祝日 ja.portuguese#holiday@group.v.calendar.google.com
ポーランドの祝日 ja.polish#holiday@group.v.calendar.google.com
マレーシアの祝日 ja.malaysia#holiday@group.v.calendar.google.com
メキシコの祝日 ja.mexican#holiday@group.v.calendar.google.com
ユダヤ教の祝日 ja.jewish#holiday@group.v.calendar.google.com
ロシアの祝日 ja.russian#holiday@group.v.calendar.google.com
中国の祝日 ja.china#holiday@group.v.calendar.google.com
韓国の祝日 ja.south_korea#holiday@group.v.calendar.google.com
南アフリカの祝日 ja.sa#holiday@group.v.calendar.google.com
台湾の祝日 ja.taiwan#holiday@group.v.calendar.google.com
日本の祝日 ja.japanese#holiday@group.v.calendar.google.com
香港(C)の祝日 ja.hong_kong_c#holiday@group.v.calendar.google.com
香港の祝日 ja.hong_kong#holiday@group.v.calendar.google.com

 

也可以参考:https://calendar.teamup.com/kb/holiday-calendar-feeds-preview-teamup/

 

Country Holiday Calendar feed URL
(Copy a feed URL, then follow step 2 here to add it to your Teamup Calendar)
United States
Preview
https://calendar.google.com/calendar/ical/en.usa#holiday@group.v.calendar.google.com/public/basic.ics
United Kingdom
Preview
https://calendar.google.com/calendar/ical/en.uk#holiday@group.v.calendar.google.com/public/basic.ics
Algeria
Preview
https://calendar.google.com/calendar/ical/en.dz#holiday@group.v.calendar.google.com/public/basic.ics
Argentina
Preview
https://calendar.google.com/calendar/ical/en.ar#holiday@group.v.calendar.google.com/public/basic.ics
Australia
Preview
https://calendar.google.com/calendar/ical/en.australian#holiday@group.v.calendar.google.com/public/basic.ics
Austria
Preview
https://calendar.google.com/calendar/ical/en.austrian#holiday@group.v.calendar.google.com/public/basic.ics
Bahamas
Preview
https://calendar.google.com/calendar/ical/en.bs#holiday@group.v.calendar.google.com/public/basic.ics
Belarus
Preview
https://calendar.google.com/calendar/ical/en.by#holiday@group.v.calendar.google.com/public/basic.ics
Belgium
Preview
https://calendar.google.com/calendar/ical/en.be#holiday@group.v.calendar.google.com/public/basic.ics
Bolivia
Preview
https://calendar.google.com/calendar/ical/en.bo#holiday@group.v.calendar.google.com/public/basic.ics
Brazil
Preview
https://calendar.google.com/calendar/ical/en.brazilian#holiday@group.v.calendar.google.com/public/basic.ics
Bulgaria
Preview
https://calendar.google.com/calendar/ical/en.bulgarian#holiday@group.v.calendar.google.com/public/basic.ics
Canada
Preview
https://calendar.google.com/calendar/ical/en.canadian#holiday@group.v.calendar.google.com/public/basic.ics
Cayman
Islands
Preview
https://calendar.google.com/calendar/ical/en.ky#holiday@group.v.calendar.google.com/public/basic.ics
Chile
Preview
https://calendar.google.com/calendar/ical/en.cl#holiday@group.v.calendar.google.com/public/basic.ics
China
Preview
https://calendar.google.com/calendar/ical/en.china#holiday@group.v.calendar.google.com/public/basic.ics
Colombia
Preview
https://calendar.google.com/calendar/ical/en.co#holiday@group.v.calendar.google.com/public/basic.ics
Congo
Preview
https://calendar.google.com/calendar/ical/en.cg#holiday@group.v.calendar.google.com/public/basic.ics
Costa Rica
Preview
https://calendar.google.com/calendar/ical/en.cr#holiday@group.v.calendar.google.com/public/basic.ics
Croatia
Preview
https://calendar.google.com/calendar/ical/en.croatian#holiday@group.v.calendar.google.com/public/basic.ics
Cuba
Preview
https://calendar.google.com/calendar/ical/en.cu#holiday@group.v.calendar.google.com/public/basic.ics
Czech
Republic
Preview
https://calendar.google.com/calendar/ical/en.czech#holiday@group.v.calendar.google.com/public/basic.ics
Denmark
Preview
https://calendar.google.com/calendar/ical/en.danish#holiday@group.v.calendar.google.com/public/basic.ics
Dominican Republic
Preview
https://calendar.google.com/calendar/ical/en.do#holiday@group.v.calendar.google.com/public/basic.ics
Ecuador
Preview
https://calendar.google.com/calendar/ical/en.ec#holiday@group.v.calendar.google.com/public/basic.ics
Egypt
Preview
https://calendar.google.com/calendar/ical/en.eg#holiday@group.v.calendar.google.com/public/basic.ics
El Salvador
Preview
https://calendar.google.com/calendar/ical/en.sv#holiday@group.v.calendar.google.com/public/basic.ics
Equatorial Guinea
Preview
https://calendar.google.com/calendar/ical/en.gq#holiday@group.v.calendar.google.com/public/basic.ics
Finland
Preview
https://calendar.google.com/calendar/ical/en.finnish#holiday@group.v.calendar.google.com/public/basic.ics
France
Preview
https://calendar.google.com/calendar/ical/en.french#holiday@group.v.calendar.google.com/public/basic.ics
Gabon
Preview
https://calendar.google.com/calendar/ical/en.ga#holiday@group.v.calendar.google.com/public/basic.ics
Germany
Preview
https://calendar.google.com/calendar/ical/de.german#holiday@group.v.calendar.google.com/public/basic.ics
Greece
Preview
https://calendar.google.com/calendar/ical/en.greek#holiday@group.v.calendar.google.com/public/basic.ics
Greenland
Preview
https://calendar.google.com/calendar/ical/en.gl#holiday@group.v.calendar.google.com/public/basic.ics
Haiti
Preview
https://calendar.google.com/calendar/ical/en.ht#holiday@group.v.calendar.google.com/public/basic.ics
Hong Kong
Preview
https://calendar.google.com/calendar/ical/en.hong_kong#holiday@group.v.calendar.google.com/public/basic.ics
Hungary
Preview
https://calendar.google.com/calendar/ical/en.hungarian#holiday@group.v.calendar.google.com/public/basic.ics
Iceland
Preview
https://calendar.google.com/calendar/ical/en.is#holiday@group.v.calendar.google.com/public/basic.ics
India
Preview
https://calendar.google.com/calendar/ical/en.indian#holiday@group.v.calendar.google.com/public/basic.ics
Indonesia
Preview
https://calendar.google.com/calendar/ical/en.indonesian#holiday@group.v.calendar.google.com/public/basic.ics
Iraq
Preview
https://calendar.google.com/calendar/ical/en.iq#holiday@group.v.calendar.google.com/public/basic.ics
Ireland
Preview
https://calendar.google.com/calendar/ical/en.irish#holiday@group.v.calendar.google.com/public/basic.ics
Israel
Preview
https://calendar.google.com/calendar/ical/en.jewish#holiday@group.v.calendar.google.com/public/basic.ics
Italy
Preview
https://calendar.google.com/calendar/ical/en.italian#holiday@group.v.calendar.google.com/public/basic.ics
Jamaica
Preview
https://calendar.google.com/calendar/ical/en.jm#holiday@group.v.calendar.google.com/public/basic.ics
Japan
Preview
https://calendar.google.com/calendar/ical/en.japanese#holiday@group.v.calendar.google.com/public/basic.ics
Jordan
Preview
https://calendar.google.com/calendar/ical/en.jo#holiday@group.v.calendar.google.com/public/basic.ics
Kenya
Preview
https://calendar.google.com/calendar/ical/en.ke#holiday@group.v.calendar.google.com/public/basic.ics
Kuwait
Preview
https://calendar.google.com/calendar/ical/en.kw#holiday@group.v.calendar.google.com/public/basic.ics
Latvia
Preview
https://calendar.google.com/calendar/ical/en.latvian#holiday@group.v.calendar.google.com/public/basic.ics
Liechtenstein
Preview
https://calendar.google.com/calendar/ical/en.li#holiday@group.v.calendar.google.com/public/bPreviewasic.ics
Lithuania
Preview
https://calendar.google.com/calendar/ical/en.lithuanian#holiday@group.v.calendar.google.com/public/basic.ics
Luxembourg
Preview
https://calendar.google.com/calendar/ical/en.lu#holiday@group.v.calendar.google.com/public/basic.ics
Macao
Preview
https://calendar.google.com/calendar/ical/en.mo#holiday@group.v.calendar.google.com/public/basic.ics
Madagascar
Preview
https://calendar.google.com/calendar/ical/en.mg#holiday@group.v.calendar.google.com/public/basic.ics
Malawi
Preview
https://calendar.google.com/calendar/ical/en.mw#holiday@group.v.calendar.google.com/public/basic.ics
Malaysia
Preview
https://calendar.google.com/calendar/ical/en.malaysia#holiday@group.v.calendar.google.com/public/basic.ics
Mali
Preview
https://calendar.google.com/calendar/ical/en.ml#holiday@group.v.calendarPreview.google.com/public/basic.ics
Malta
Preview
https://calendar.google.com/calendar/ical/en.mt#holiday@group.v.calendar.google.com/public/basic.ics
Mauritius
Preview
https://calendar.google.com/calendar/ical/en.mu#holiday@group.v.calendar.google.com/public/basic.ics
Mexico
Preview
https://calendar.google.com/calendar/ical/en.mexican#holiday@group.v.calendar.google.com/public/basic.ics
Monaco https://calendar.google.com/calendar/ical/en.mc#holiday@group.v.calendar.google.com/public/basic.ics
Mongolia
Preview
https://calendar.google.com/calendar/ical/en.mn#holiday@group.v.calendar.google.com/public/basic.ics
Montenegro
Preview
https://calendar.google.com/calendar/ical/en.me#holiday@group.v.calendar.google.com/public/basic.ics
Morocco
Preview
https://calendar.google.com/calendar/ical/en.ma#holiday@group.v.calendar.google.com/public/basic.ics
Myanmar
Preview
https://calendar.google.com/calendar/ical/en.mm#holiday@group.v.calendar.google.com/public/basic.ics
Netherlands
Preview
https://calendar.google.com/calendar/ical/en.dutch#holiday@group.v.calendar.google.com/public/basic.ics
New Zealand
Preview
https://calendar.google.com/calendar/ical/en.new_zealand#holiday@group.v.calendar.google.com/public/basic.ics
Norway
Preview
https://calendar.google.com/calendar/ical/en.norwegian#holiday@group.v.calendar.google.com/public/basic.ics
Oman
Preview
https://calendar.google.com/calendar/ical/en.om#holiday@group.v.calendar.google.com/public/basic.ics
Pakistan
Preview
https://calendar.google.com/calendar/ical/en.pk#holiday@group.v.calendar.google.com/public/basic.ics
Panama
Preview
https://calendar.google.com/calendar/ical/en.pa#holiday@group.v.calendar.google.com/public/basic.ics
Paraguay
Preview
https://calendar.google.com/calendar/ical/en.py#holiday@group.v.calendar.google.com/public/basic.ics
Peru
Preview
https://calendar.google.com/calendar/ical/en.pe#holiday@group.v.calendar.google.com/public/basic.ics
Philippines
Preview
https://calendar.google.com/calendar/ical/en.philippines#holiday@group.v.calendar.google.com/public/basic.ics
Poland
Preview
https://calendar.google.com/calendar/ical/en.polish#holiday@group.v.calendar.google.com/public/basic.ics
Portugal
Preview
https://calendar.google.com/calendar/ical/en.portuguese#holiday@group.v.calendar.google.com/public/basic.ics
Puerto Rico
Preview
https://calendar.google.com/calendar/ical/en.pr#holiday@group.v.calendar.google.com/public/basic.ics
Qatar
Preview
https://calendar.google.com/calendar/ical/en.qa#holiday@group.v.calendar.google.com/public/basic.ics
Republic of Korea
Preview
https://calendar.google.com/calendar/ical/en.south_korea#holiday@group.v.calendar.google.com/public/basic.ics
Romania
Preview
https://calendar.google.com/calendar/ical/en.romanian#holiday@group.v.calendar.google.com/public/basic.ics
Russian
Federation
Preview
https://calendar.google.com/calendar/ical/en.russian#holiday@group.v.calendar.google.com/public/basic.ics
Saudi Arabia
Preview
https://calendar.google.com/calendar/ical/en.saudiarabian#holiday@group.v.calendar.google.com/public/basic.ics
Senegal
Preview
https://calendar.google.com/calendar/ical/en.sn#holiday@group.v.calendar.google.com/public/basic.ics
Serbia
Preview
https://calendar.google.com/calendar/ical/en.rs#holiday@group.v.calendar.google.com/public/basic.ics
Singapore
Preview
https://calendar.google.com/calendar/ical/en.singapore#holiday@group.v.calendar.google.com/public/basic.ics
Slovakia
Preview
https://calendar.google.com/calendar/ical/en.slovak#holiday@group.v.calendar.google.com/public/basic.ics
Slovenia
Preview
https://calendar.google.com/calendar/ical/en.slovenian#holiday@group.v.calendar.google.com/public/basic.ics
South Africa
Preview
https://calendar.google.com/calendar/ical/en.sa#holiday@group.v.calendar.google.com/public/basic.ics
Spain
Preview
https://calendar.google.com/calendar/ical/en.spain#holiday@group.v.calendar.google.com/public/basic.ics
Sweden
Preview
https://calendar.google.com/calendar/ical/en.swedish#holiday@group.v.calendar.google.com/public/basic.ics
Switzerland
Preview
https://calendar.google.com/calendar/ical/en.ch#holiday@group.v.calendar.google.com/public/basic.ics
Taiwan
Preview
https://calendar.google.com/calendar/ical/en.taiwan#holiday@group.v.calendar.google.com/public/basic.ics
Thailand
Preview
https://calendar.google.com/calendar/ical/en.th#holiday@group.v.calendar.google.com/public/basic.ics
Turkey
Preview
https://calendar.google.com/calendar/ical/en.turkish#holiday@group.v.calendar.google.com/public/basic.ics
U.S. Virgin Islands
Preview
https://calendar.google.com/calendar/ical/en.vi#holiday@group.v.calendar.google.com/public/basic.ics
Ukraine
Preview
https://calendar.google.com/calendar/ical/en.ukrainian#holiday@group.v.calendar.google.com/public/basic.ics
United Arab Emirates
Preview
https://calendar.google.com/calendar/ical/en.ae#holiday@group.v.calendar.google.com/public/basic.ics
Venezuela
Preview
https://calendar.google.com/calendar/ical/en.ve#holiday@group.v.calendar.google.com/public/basic.ics
Vietnam
Preview
https://calendar.google.com/calendar/ical/en.vietnamese#holiday@group.v.calendar.gPreviewoogle.com/public/basic.ics
Yemen
Preview
https://calendar.google.com/calendar/ical/en.ye#holiday@group.v.calendar.google.com/public/basic.ics

关于中国农历,可以参考文章:改造FullCalendar增加节气、节日和农历显示, add lunar for FullCalendar

 

本文:添加holiday假日到fullcalendar ,Add Holiday Calendars to Full Calendar