Google Calendar, Timezones and daylight saving

I’m fully aware of how complicated and dangerous working with timezones can be, especially if recurring events and daylight saving are involved.

Outsourcing calendar event creation

So when I decided that I wanted my kids school timetables in ics format and that I’d ‘outsource’ the manual data entry of it, I took great care to setup the calendars myself, specifying the Australia/Sydney Timezone.     I found a great person on elance based in the states who was knowledgeable about google calendar and recurring events.  I shared the time table calendars with her.  She set up the events in the two timetables. I checked it and all was good for a few weeks.

Then the normal Sydney (NSW) daylight saving period ended.

And NOW all the timetable events were TWO hours out – yes two (2) ?? why?

Being knowledgeable in these matters and having done SO many tests with timezones changing daylight saving at different overlapping times etc, I knew that it must be something to do with timezones.  I logged on to google and could not find anything online that told me anything.  Timetable calendars still set to Sydney, but all the events now mysteriously 2 hours out.

Troubleshooting google calendar – check the ics file

I downloaded the ics file to see if that would shed any light.    The ics file had a timezone definition for Australia/Sydney AND for America/New_York and ALL the class events were defined with timezone America/New_York.

Now google very clearly says that it stores the events in UTC / GMT time.

So why export events for a timezone OTHER than

  • either UTC or the
  • calendars timezone or
  • the accounts timezone?

why not just one hour out?     Had I missed the New York daylight saving change on 9 Mar?  Maybe ?   The times are just of the hour like 10.50 instead of 8.50 – maybe when I saw 9.50 I just thought 9 ?  who knows?

How to avoid unintended timezone daylight saving clashes happening again ?

Well I’m guessing – it appears google will use the timezone of the person creating the event EVEN if the calendar is in a different timezone AND this timezone is NOT shown when one looks at the event, NOT even in event debug / troubleshooting mode (add &eventdeb=1 to your google calendar url).

The creator has to manually assign a timezone to each and every event to ensure that it gets exported correctly.

 How to fix the current timetables offset by two hours?

I didn’t want to delete the existing calendars and Google allows no other easy way to delete events from any non-main calendar other than deleting the whole calendar.

I decided  a temporary fix (until the next daylight change !)  would be to export to ics, do a global change to a timezone 2 hours before New_York (hopefully one with out daylight saving – sadly I gave up on that)

I created a test calendar and did several iterations to check the timings. I ended up using http://gcaltoolkit.net/ to handle bulk deletes of the calendars and learnt a few things along the way:

For example: Even if you have deleted the events and want to re-import them, google will not let you.  To fox it – do a gloabl change on the @google.com of the UID .  Events are identified by UID.

At one stage I even felt I needed to change the file name and calendar name, but perhaps I was just tired, confused and annoyed by then.

Summary:

  1. BACKUP all your google calendars and possibly other data first before letting another app mess with your data.  Create a TEST calendar to test the whole process.
  2. Export your ics files, create a backup copy.
  3. Use something like notepad++ to do a search/replace on the timezone.  Make sure your new timezone is something google will recognise and the correct UTC offset.
  4. Search and replace the @google.com to @yourdomain.com or really anything…(alter the event UID globally every time you re-import the file.)
  5. Save and close the ics file.
  6. Use gcaltoolkit or similar to delete the events in your target calendar (very carefully check which calendar you are accessing)
  7. Make a cup of tea – ieWait a few minutes, sometimes it takes google a while to update.
  8. Import the ics file and check the times.

 

 

 

Posted in Notes | Tagged , , , , | Comments Off

Importing events from a csv file

Simple ‘flat’ events can be imported from a csv file.  This is possible with a third party csv import plugins. The amr-events plugin attempts to use the wordpress meta data as simply as possible to facilitate this kind of easy integration with other plugins.

Events can be complicated: they can recur, be in different timezones, have exceptions to their recurring definition, have alterations to some instances etc.    These ‘complications’ cannot so easily be imported.

From a brief review of the csv import plugins out there, starting with the self named “ultimate csv importer” and backing away in disappointment, I read reviews of a few others and decided to try the really simple importer.   It worked so nicely and cleanly that I stopped there!

What a pleasure to see a plugin that

  • inserts itself sensibly into wordpress, adding itself under tools > import just where it should be
  • imports the data with limited fuss, very sensibly using the column headings, making sensible defaults for missing fields instead of insisting that they are mandatory data. eg: choose to include a post_status, or let it default to draft and ‘publish’ it later.
  • handles custom fields and custom post types as easily as they should be handled – why should there be a ‘fuss’

 So how to import events?

I suggest you create yourself a test event or two that are similar to the event data that you wish to import.  This is so that you can see the meta data that is created.  The amr events plugin tries to stay close to the ICS RFC spec formats for the data, but is sophisticated enough to cope with a reasonable set of date formats and will work with minimal event data input.   Sample files provided below.   The plugin needs

  • some of the standard wordpress post data, as little as your chosen csv importer will cope with.
    • post_title
    • post_content
    • post_type = event (or whatever you have in your settings, or load as post and change afterwards if your csv importer is a bit ‘dumb’.)
  • a minimal set of event meta data (see example file for variations):
    • _DTSTART in RFC format eg: 20140402T090000   or 20140402
  • optional extras:
    • _DTEND  (to define any timed events or events of greater than 1 day.  NOTE RFC 5545 says _DTEND ends on NEXT day for one day events – be careful what you define and test it!)
    • _timezone (if timezone differs from UTC or your website timezone – careful testing with your setup)
    • _allday (timed or allday)
    • _LOCATION
    • see your sample events post-meta in phpmyadmin for more possibilities.

Notes:

  • It is probably not practical to try CSV importing recurring _RRULE data or detailed duration data (use DTEND rather)
  • If you experience any problems, please consider carefully whether it is a problem with your chosen CSV importer and if so, log your support query there.
  • If some data goes in a bit wonky – maybe you set it up a bit wrong, the amr-events plugin does try to correct things – update the post and save.

Screenshots:

imported csv events

variety of events with various data supplied or omited

really simple csv  import screen

really simple csv import screen

 

import csv menu

The csv import option is right there in the wordpress import menu – exactly the right place

Example Event CSV file:

minimal_events

Posted in amr events, How To | Tagged , | Comments Off

Styling the dates

I received a question about whether the plugin could style dates in the way the little purple date is shown in the header image of the website and the plugins wordpress page.

a real life example

a real life example

 

The calendars shown in the header are taken from real live examples of the plugin being used in various sites.  The sites will in many cases have added custom css to style the events lists to match their themes.

With a combination of the date and time formats in the settings for each list and some css, almost anything is possible.

The key is that one can add extra characters into the php date format string.  If the characters are the same as a date format character, one can ‘escape’ them with a preceding backslash.

Sooo…. one could for example add some html to isolate part of the date for css styling purposes.   The image below shows the date and time format settings for a event list.   Note the format string for the day.   It surrounds the month with a span.

\<\s\p\a\n\>M\<\/\s\p\a\n\>j
adding html to the date format

Date format settings for a event listtype

Then one can spice it up with some custom css.  To prove this, I have used the power of the firebug browser add-on to add some element css to show you what could be done.  I’d put the text-align: center at a higher level actually – no need to repeat it.

You of course would add the css for the event date class and the span within it to your theme or to a custom calendar css file.

Example styling of a month and day (prof of concept facilitated by firebug browser add-on)

Example styling of a month and day (prof of concept facilitated by firebug browser add-on)

Posted in Css, How To | Comments Off

Very versatile

From the forum

First, I love the plugin. Very versatile. Thank you.

Posted in Testimonials | Comments Off

Finding the Facebook events ics feed for subscribing or syncing

I’m not a fan of facebook…..however I get asked the questions, so have had to develop some familiarity, so here’s a quick reference until facebook changes things again.

Before you get too stuck in to facebook for your events,  look at oreilly.com’s advice on perhap not using facebook as the home for your public events.

Finding that public events ics feed in facebook

From a facebook ‘page’

They really do not make it easy do they ?  There is no obvious ‘Export all’ as there is in the personal page.  So…Pretend you’re only exporting one event from your page.

Example fb page

Example Facebook page – events page

Click the event

The facebook events lists, click export.

Click export.

Choose subscribe to all events, or right click and copy the link address

Copy that webcal ics address and use it wherever you need to subscribe to that set of events.

From a personal homepage

After logging in look for the export events option, not just for one event but ALL upcoming events.

Go to your all events page:   https://www.facebook.com/events/list.

Click "Export"In the top right corner, see the little gear icon, click it and click the export option.

 

You should get a popup window.

export facebook ics

export facebook ics

If you just want the url to subscribe to it from another application, right click and ‘copy the link address’. Paste it in to your calendars subscribe url option.

Alternatively if you just click on it, your calendar application should open up and hanlde the subscription process for you.

Use it in the ical events plugin?

facebook in shortcode

facebook in shortcode

Bear in mind that the plugin caches the url’s, so you may need to force a refresh (add ?refresh) to the calendar page url and refresh the page in your browser.

eg:

 

Other possibly useful references:

Posted in amr ical events list, How To | Tagged | Comments Off

absolute HEAVEN

From the wordpress forum.

Firstly, this plugin is absolute HEAVEN and it totally looks great. Thank you so much!

Posted in Testimonials | Comments Off

Table css, overlapping or disappearing sidebars

Table widths and css

Tables are wonderful  - they expand beautifully and naturally to fit your content, but sometimes that same content can make the table do  weird things.

Loooong Urls

Please be sure to test your css in your theme with representative content.

The plugin tries to deal with some of the problems that occur.  For example long urls that can make a table expand too much.   See also plugin-and-theme-css-not-working-well-together.

Sometimes the only way to really sort a table width out is to “fix” the width of the table and/or the table cells.    Now this the plugin has to leave this to you – some people have wide content areas, some not.  Some have lots of info displayed,  others have minimal.

The plugin has no way of knowing what size would work best for you.

I suggest that you use something like firebug to see what your theme is doing (or not doing!) and then google table+css+width for ideas on what might work with your theme.   You know the size of content area that your calendar or agenda list must fit into and perhaps simply setting the width of the table and/or the table cells will be the answer.

Coping with a wide table

A suggestion from 456bereastreet.com

Css3 options:

  • word-wrap: break-word has some browser support
  • word-break: (normal, break-all, keep-all) aimed at dealing with mixed character sets.  Random Break Point.

Resources:

See posts on this site tagged css.

Posted in Css | Comments Off

A sweet positive note from a graphic designer

I just happened upon this - Thanks for the credit Ethan!

A great wordpress plugin

partial screenshot of ethan's resources page

Ethan Hazzard-Watkins is a graphic designer

Posted in Testimonials | Comments Off

Update to v 4.0.28 rich snippets in html5, google add event to calendar

Cat pondering timezone differences

So if the website timezone is San Francisco, and the link generates UTC time and my google calendar is in Sydney... then it's right ?

Version 4.0.28 of amr-ical-events-list is now available at wordpress and fixes two annoying bugs:

  • In trying to make the html5 list options ‘clean’ some html markup was removed – this meant that the necessary classes for  google rich snippets, or microformats was no longer available.  The necessary markup is now back.  Lists that did not use html5 were always and are still okay.
  • At time of writing the google documentation does NOT adhere to the ics specification for all day events – it does the human view.  Actual functioning and their event button html generator tool does adhere to the spec.  This means that in the google link the end day for all day events must be the ‘next’ day.  (Think of it as the all day event ends at the very start of the next day.)
  • When testing be aware:  the links to add an event to google are required to have dates and times in UTC timezone.  If your timezone is very different – eg when  you live on the other side of the world, testing can get very confusing -… add in a daylight saving change and you need some good maths skills… or set your website temporarily to UTC !

 

Posted in Changelog | Comments Off

wonderful dynamic plugin

From mick in the forum

First of all many thanks for your wonderful dynamic plugin. It has really gotten me out of a hole. Very useful indeed.

Posted in Testimonials | Comments Off