google 日历 API 重复时区
google calendar API repeat timezones
我正在尝试使用此包装器插入重复事件:
https://github.com/spatie/laravel-google-calendar
日期没有问题,但日期+时间涉及时区
我不断收到此错误:
(400) 缺少开始时间的时区定义。
[
"name" => "Test name here"
"location" => "Brisbane Australia"
"description" => "Desc here..."
"timeZone" => "Australia/Brisbane"
"colorId" => 4
"startDateTime" => "2017-03-01 14:00:00"
"endDateTime" => "2017-03-01 15:00:00"
"recurrence" => ["RRULE:FREQ=DAILY;INTERVAL=1;"]
]
我不知道如何为这些开始和结束日期时间值添加时区
对不起,伙计,这个包做不到。
Limitations
The Google Calendar API provides many options. This package doesn't support all of them. For instance recurring events cannot be managed properly with this package. If you stick to creating events with a name and a date you should be fine.
https://github.com/spatie/laravel-google-calendar#limitations
根据Google Calendar API documentation, the field start.dateTime
(supposedly your "startDateTime"
field) is assumbed to be RFC 3339格式。 (我假设你必须对 endDateTime
做同样的事情)。
您需要将日期转换为该格式。
如果你的原始数据是DateTime object,你可以这样转换它:
<?php
$startDateTime = DateTime::createFromFormat("Y-m-d H:i:s", "2017-03-01 14:00:00");
echo $startDateTime->format(DateTime::RFC3339);
将输出:
2017-03-01T14:00:00+08:00
此格式包含时区。
我正在尝试使用此包装器插入重复事件: https://github.com/spatie/laravel-google-calendar
日期没有问题,但日期+时间涉及时区
我不断收到此错误:
(400) 缺少开始时间的时区定义。
[
"name" => "Test name here"
"location" => "Brisbane Australia"
"description" => "Desc here..."
"timeZone" => "Australia/Brisbane"
"colorId" => 4
"startDateTime" => "2017-03-01 14:00:00"
"endDateTime" => "2017-03-01 15:00:00"
"recurrence" => ["RRULE:FREQ=DAILY;INTERVAL=1;"]
]
我不知道如何为这些开始和结束日期时间值添加时区
对不起,伙计,这个包做不到。
Limitations
The Google Calendar API provides many options. This package doesn't support all of them. For instance recurring events cannot be managed properly with this package. If you stick to creating events with a name and a date you should be fine.
https://github.com/spatie/laravel-google-calendar#limitations
根据Google Calendar API documentation, the field start.dateTime
(supposedly your "startDateTime"
field) is assumbed to be RFC 3339格式。 (我假设你必须对 endDateTime
做同样的事情)。
您需要将日期转换为该格式。
如果你的原始数据是DateTime object,你可以这样转换它:
<?php
$startDateTime = DateTime::createFromFormat("Y-m-d H:i:s", "2017-03-01 14:00:00");
echo $startDateTime->format(DateTime::RFC3339);
将输出:
2017-03-01T14:00:00+08:00
此格式包含时区。