Google add to calendar button bug

Add to Google Calendar bug
Add to Google Calendar bug

Imagine situation when you are hosting an event or you have a website that regularly organizes events. You create a page, add time and place of event and then you decide to add a Google Calendar button to make things look fancy.

So you google it and you find a script like this:

<a href="
&location=123%20Main%20St%2C%20Example%2C%20NY">Add to gCal</a>

Looks simple, you just need to edit some url parameters, most importantly dates parameter.

You type in your event data and here comes trouble.

Google Calendar adds couple of hours to your specified time. Why is that?

To be short, this is the reason:

  • To use the user’s timezone: 20131208T160000/20131208T180000
  • To use global time: 20131208T160000Z/20131208T180000Z

Did you notice that “Z” at the end? That is the reason why your Google Calendar is adding some time to the official event time.

Lesson learned

  • Do not blindly copy & paste code from internet.
  • Always know what you are doing.
  • Solve problems immediately, not 1 year after it was reported (note for myself).

Leave a comment

Your email address will not be published. Required fields are marked *