In this ticket linked below, Luo Yang helped us get functionality that would take a Start Date and time for an event from the Toolset field and put it in the format needed for a link to add that event to Google Calendar.
https://toolset.com/forums/topic/add-to-google-calendar-functionality-on-custom-content-type-in-toolset/
That was working fine before, but now I'm seeing that when you click on the link, it has the wrong date and time on the Google calendar listing that results.
The code we have in our Ride content type template that Luo Yang helped us with is here:
<div class="epta-addto-calendar" style="margin-top: 10px;"><a href="<em><u>hidden link</u></em> field='start-date-and-time' style='text' format='Ymd'][/types]T[types field='start-date-and-time' style='text' format='His'][/types][types field='end-date-and-time' style='text' format='Ymd'][/types]T[types field='end-date-and-time' style='text' format='His'][/types]&text=[wpv-post-title]&location=[types field='ride-start-address'][/types]&trp=false&ctz=America/New_York&sprop=website:<em><u>hidden link</u></em>" target="_blank" rel="noopener">+ Google Calendar</a></div>
It looks to me like the link this generates is still correct. We can test using this ride page:
hidden link
The date and time of this ride is October 22, 2023 at 8:00am.
On that ride page, the link generated by the code above is here:
hidden link
Looking at this, I'm seeing the date showing as 20231022T080000T. That should be correct. But when you click on the link, the resulting Google page shows the date as follows:
Oct 15, 2023
10:00pm
to
11:00pm
Any idea why this would be happening?
Hi,
Thank you for contacting us and I'd be happy to assist.
This question is not directly related to Toolset's functionality and involves how the Google Calendar API recognizes the date parameter for events. For the most accurate and long-term solution, I recommend consulting their official support and documentation.
As per my testing and research, it now expects both the start and end times of the event separated by '/', in the 'dates' parameter:
Example:
20231022T080000Z/20231022T080000Z
20231022T080000Z%2F20231022T080000Z
( URL encoded replacing / with %2F )
You'll see that this link works to add the event correctly as per 'October 22, 2023 8:00 am':
( you may have to adjust it a little for the timezone )
<em><u>hidden link</u></em>
I hope this helps and please let me know if you need further assistance.
regards,
Waqar
I've added the %2F to the code in the Ride template. That looks like it worked for producing the correct start date/time. Thanks a bunch.
I have to figure out what we want to do with the end time here. Most of our rides do not include an end time, so it might be better to pull that from the link code if that won't mess things up. But getting the start time right was the purpose of this ticket and that is solved now. Thanks for the fix there. I'm not sure if I'd have ever found that change was needed. I searched for solutions before posting this ticket but didn't find that.