Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar Typescript Schema$EventDateTime.date type missing null #1559

Closed
joshuajtaylor opened this issue Jan 21, 2019 · 0 comments · Fixed by #1824
Closed

Calendar Typescript Schema$EventDateTime.date type missing null #1559

joshuajtaylor opened this issue Jan 21, 2019 · 0 comments · Fixed by #1824
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. TypeScript

Comments

@joshuajtaylor
Copy link

joshuajtaylor commented Jan 21, 2019

Using the Google Calendar API, the interface Schema$EventDateTime defines date without allowing null. However, start.date must be set to null when using calendar_v3.events.patch() to convert an all-day event to a time-limited event. The other option is to use the calendar_v3.events.update() method but this isn't an option for our implementation.

Definition in code:

googleapis version: [email protected]

Code example:

const requestBody: calendar_v3.Schema$Event = {
  start: {
    dateTime: newEvent.start_time.toISOString(),
    date: '', // a null is necessary if we need to revert an all-day event back to a time-limited event
  },
  end: {
    dateTime: newEvent.end_time.toISOString(),
    date: '', // a null is necessary if we need to revert an all-day event back to a time-limited event.
  },
};

// "any" hack to get TypeScript to compile
(requestBody as any).start.date = null;
(requestBody as any).end.date = null;

const res = await calendar.events.patch({
    calendarId: googleCalendar.google_id,
    eventId: googleEvent.google_id,
    sendUpdates: 'all',
    requestBody,
}, undefined);

EDIT: Added code example

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Jan 22, 2019
@JustinBeckwith JustinBeckwith added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. TypeScript labels Jan 28, 2019
@yoshi-automation yoshi-automation removed triage me I really want to be triaged. 🚨 This issue needs some love. labels Jan 28, 2019
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Jul 29, 2019
@JustinBeckwith JustinBeckwith self-assigned this Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants