Google calendar api “插入”时出现谷歌日历API错误;指定的时间范围为空";

Google calendar api “插入”时出现谷歌日历API错误;指定的时间范围为空";,google-calendar-api,Google Calendar Api,如果您收到错误“指定的时间范围为空”或下面的错误响应 { "error": { "errors": [ { "domain": "calendar", "reason": "timeRangeEmpty", "message&

如果您收到错误“指定的时间范围为空”或下面的错误响应

{
    "error": {
        "errors": [
            {
                "domain": "calendar",
                "reason": "timeRangeEmpty",
                "message": "The specified time range is empty.",
                "locationType": "parameter",
                "location": "timeMax"
            }
        ],
    "code": 400,
    "message": "The specified time range is empty."
}
}

大多数情况下,当开始>结束时会遇到此问题

示例:您正在指定开始和结束日期,如下所示:

  • 开始时间:2020-10-10T13:30:00+5:30(即2020年10月10日下午1:30)
  • 完:2020-10-10T13:00:00+5:30(即2020年10月10日下午1:00)
结束时间应大于开始时间

{
    "summary": "some summary",
    "description": "some description",
    "location": "some location",
    "end":  {"dateTime" : "2020-10-10T13:30:00+5:30"},
    "start" : { "dateTime" : "2020-10-10T13:00:00+5:30"},
}