Events created via API are not listed in printing

前端 未结 1 1084
不知归路
不知归路 2021-01-22 08:48

I have created one google calendar with my gmail account and I want to display that calendar in my website.

All Events related to that calender\'s are inserted via googl

1条回答
  •  离开以前
    2021-01-22 09:42

    I was having this problem with events created in a Chrome Extension. I'll spare you the code for the token, but I think it's enough that the event is created without any problems, yet refuses to print.

    Desired behaviour: create event that can be printed. Specific Error: event is created, but can not be printed. Code:

    var copyInit = {
                                'method': 'POST',
                                'async': true,
                                'headers': {
                                    'Authorization': 'Bearer ' + Items.access_token,
                                    'Content-Type': 'application/json'
                                },
                                'contentType': 'json',
                                'body': dataJson
                            };
    

    dataJson:

    "{"start":{"date":"2019-04-22"},"end":{"date":"2019-04-22"},"summary":"test"}"
    

    API Call:

                var url = 'https://www.googleapis.com/calendar/v3/calendars/' + calId + '/events?key=AIzaSyDfX9-blah9KoxzvGu3IzA1zu0oDQ-cJfw';
            fetch(url, copyInit)
    

    After much head scratching it turns out that although the Google Calendar API allows you to create all day events using the same start date and end date for all day events (using YYYY-MM-DD), such events can not be printed, and when shared will have an end date previous to the start date...

    The solution is to use the following day as the end date for all day events:

    "{"start":{"date":"2019-04-22"},"end":{"date":"2019-04-23"},"summary":"works!"}"
    

    0 讨论(0)
提交回复
热议问题