I am able to create an event using this link to google calendar. but time is coming as UTC i think (its 5.30 hours ahead the time I wanted on event)
Example: This link will create an event but it shows time from 12.30pm to 4pm. This event supposed to be 6.30am to 10am.
According to this link, removing Z from time string should set user's local time in event.
to use the user's timezone: 20201231T193000/20201231T223000 (don't specify a timezone);
to use UTC timezone, convert datetime to UTC, then use Z suffix: 20201231T193000Z/20201231T223000Z;
I have also tried the same solution from this link but still event time is not coming as it. its getting converted in the link.
const startDateTimeFormattedGoogle = eventStartDateTime ? eventStartDateTime.format(
"YYYYMMDDTHHmmss"
) : null;
const endDateTimeFormattedGoogle = eventEndDateTime ? eventEndDateTime.format(
"YYYYMMDDTHHmmss"
) : null;
const addToGoogleLink = `https://calendar.google.com/calendar/render?action=TEMPLATE&dates=${startDateTimeFormattedGoogle}/${endDateTimeFormattedGoogle}&location=${data.location}&text=${data.title}`;
Update:
console.log(88888, moment(eventStartDateTime).format('YYYYMMDDTHHmmssZ'),
result: 88888 20210430T123000+00:00 20210430T160000+00:00
console.log(111111, moment(eventStartDateTime).format('YYYYMMDDTHHmmss'),
moment(eventEndDateTime).format('YYYYMMDDTHHmmss'))
result : 111111 20210430T123000 20210430T160000
result url: https://calendar.google.com/calendar/render?action=TEMPLATE&dates=20210430T123000+00:00/20210430T160000+00:00&location=Calgary, Downtown&text=The 2020 Festival