作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我创建一个事件给它一个近期的日期时,一切正常。
但是,当我在几个月后创建一个事件时,假设它在夏令时 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,
);
问题
最佳答案
问题是您过度指定了 dateTime
参数以包含偏移量,但您还提供了 timeZone
范围。在这种情况下,timeZone
参数与 dateTime
中的偏移值冲突(美国/多伦多在该日期偏移 -05:00)。
鉴于两者之间的冲突 - 它选择使用 dateTime
中指定的偏移量.
documentation for the Event resource指定,在 end.dateTime
中属性:
The time, as a combined date-time value (formatted according to RFC3339). A time zone offset is required unless a time zone is explicitly specified in timeZone.
dateTime
中删除偏移值。您指定并依赖于
timeZone
环境。
关于php - Google Calendar API Timezone 日光和标准时间问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63359818/
我是一名优秀的程序员,十分优秀!