My app is using google events to schedule appointments for users and allow them to send invites to their clients. The events and all the invites are being set up correctly. However, the email invites sent to users either have the date set in UTC or the date is in the default timezone of the organizer rather than the invitee default timezone. Below is my event object
const eventData = {
"summary": "Appointment booking for service ABC"
"description": "Appointment booking for service ABC",
'start': {
'dateTime': new Date(booking.date+" UTC"),
'timeZone': defaultTimezone()
},
'end': {
'dateTime': addDateMins(new Date(booking.date+" UTC"), parseInt(booking.duration)),
'timeZone': defaultTimezone()
},
"extendedProperties": {
"private": {
"priority": "high"
}
},
'attendees': [
{
'email' : client.email,
'displayName' :client.fName ? client.fName: "Unknown User",
'organizer' : false,
'responseStatus' : "needsAction",
}
],
'reminders': {
'useDefault': false,
'overrides': [
{'method': 'email', 'minutes': 24 * 60},
{'method': 'popup', 'minutes': 10}
]
}
};
addEvent(eventData, gMeetVersion).then((gEventResult)=>{
console.log("yeey")
})
my add event function is as follows:
export const addEvent = (eventData, conferenceDataVersion = 0)=>new Promise(function(successCallBack, errorCallback){
refreshGoogleTokens().then(()=>{
const user = JSON.parse(localStorage.getItem("user"))
const headers = {
"Content-Type": "application/json",
"Authorization": "Bearer "+ user.token
}
const url = "https://www.googleapis.com/calendar/v3/calendars/primary/events?conferenceDataVersion="
+conferenceDataVersion+"&sendUpdates=all"
axios.post(url, eventData, {headers:headers})
.then(successCallBack)
.catch(errorCallback);
}).catch(errorCallback)
})