我不清楚在将单个事件添加到用户 Google 日历的网站上具有链接的确切格式。我看到 eventbrite 已经在这里完成了,但我希望有一些明确的规格或正确方向的链接
4 回答
这是一个示例链接,您可以使用它来查看格式:
注意关键查询参数:
text
dates
details
location
这是另一个示例(取自http://wordpress.org/support/topic/direct-link-to-add-specific-google-calendar-event):
<a href="http://www.google.com/calendar/render?
action=TEMPLATE
&text=[event-title]
&dates=[start-custom format='Ymd\\THi00\\Z']/[end-custom format='Ymd\\THi00\\Z']
&details=[description]
&location=[location]
&trp=false
&sprop=
&sprop=name:"
target="_blank" rel="nofollow">Add to my calendar</a>
如果您愿意,这里有一个表格可以帮助您构建这样的链接(在前面的答案中提到):
https://support.google.com/calendar/answer/3033039 编辑:此链接不再为您提供可以使用的表格
谷歌日历和其他日历服务有一个综合文档:https ://github.com/InteractionDesignFoundation/add-event-to-calendar-docs/blob/master/services/google.md
工作链接示例:https://calendar.google.com/calendar/render?action=TEMPLATE&text=Bithday&dates=20201231T193000Z/20201231T223000Z&details=With%20clowns%20and%20stuff&location=North%20Pole
我也成功地使用了这个 URL 结构:
基本网址:
https://calendar.google.com/calendar/r/eventedit?
假设这是我的活动详情:
Title: Event Title
Description: Example of some description. See more at https://stackoverflow.com/questions/10488831/link-to-add-to-google-calendar
Location: 123 Some Place
Date: February 22, 2020
Start Time: 10:00am
End Time: 11:30am
Timezone: America/New York (GMT -5)
我会将我的详细信息转换为这些参数(URL 编码):
text=Event%20Title
details=Example%20of%20some%20description.%20See%20more%20at%20https%3A%2F%2Fstackoverflow.com%2Fquestions%2F10488831%2Flink-to-add-to-google-calendar
location=123%20Some%20Place%2C%20City
dates=20200222T100000/20200222T113000
ctz=America%2FNew_York
示例链接:
请注意,由于我使用“ctz”参数指定了时区,因此我使用本地时间作为开始日期和结束日期。或者,您可以使用 UTC 日期并排除时区参数,如下所示:
dates=20200222T150000Z/20200222T163000Z
示例链接:
对于下一个人在谷歌上搜索这个主题,我编写了一个小的 NPM 包来简化生成 Google 日历 URL 的过程。它包括 TypeScript 类型定义,供需要的人使用。希望能帮助到你!