当我创建一个活动并给出一个临近的日期时,一切都运行良好。
但是,当我创建几个月后的事件时,假设它处于夏令时 DST 之外(而我当前处于夏令时期间),则创建该事件时会出现不需要的 1 小时偏移。
下面的代码产生以下输出:
Starts 2020-12-20 9:00 Ends 2020-12-20 11:00
$event = array(
'summary' => $attributes['summary'],
'location' => $attributes['location'],
'description' => $attributes['description'],
'start' => array(
'dateTime' => 2020-12-20T10:10:00-04:00',
'timeZone' => 'America/Toronto',
),
'end' => array(
'dateTime' => 2020-12-20T10:12:00-04:00',
'timeZone' => 'America/Toronto',
),
'anyoneCanAddSelf'=>true,
'guestsCanInviteOthers'=>true,
);
问题
我应该如何更改我的代码,以便它自动工作,这样我就不需要每年两次手动更改我的代码/偏移量?
扬帆大鱼