Skip to content

Instantly share code, notes, and snippets.

Last active Jun 5, 2020
What would you like to do?
讀取 google calendar api v3 / Events: list , 轉換成 FullCalendar 的格式
var util = require('util'),
request = require('request'),
parser = require('xml2json'),
calendar_id = '',
api_key = 'AIzaSyBQal2rNhP5SRkU5hZytY7Yb8nYc5Q1nrc',
url = util.format('', calendar_id, api_key);
request({url: url}, function(error, response, json){
var data = JSON.parse(json),
transformed ={
return {
title: event.summary || '忙碌',
start: event.start.dateTime ||,
end: event.end.dateTime ||, // because may be the next day, cause a '2-all-day' event, we use here.
allDay: !!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment