Home › Forums › Calendar Products › Events Calendar PRO › iCal not exporting the correct days
- This topic has 10 replies, 4 voices, and was last updated 5 years, 10 months ago by Victor.
-
AuthorPosts
-
August 21, 2015 at 2:49 am #997838CraigParticipant
Hi
On events that are listed as all day events the iCal export is a day out
For example here
http://www.wplgroup.com/aci/event/maritime-salvage-casualty-conference-europe/
This event is setup as all day event from 2nd Sept – 3rd SeptIf my timezone is set as London (my default) the calendar exports as a 2 day event but appears as the 1st – 2nd September
If I try GMT it comes out as 1 day, 2nd September
If I try UTC +0 its the same as GMT, just a 1 day event on the 2ndThe Google calendar works fine
I am running Calendar Pro, Filterbar and Tickets as well
I have switched off all plugins and reverted to TwentyFifteen, but still the same results
Cheers
AndyAugust 21, 2015 at 8:48 am #997966GeoffMemberHey Andy and sorry for the trouble here!
I was able to download the .ice file for that event and see what you mean–it imported as a two-day event for 9/1-9/2.
Just want to confirm: is the calendar you are importing to set to a different timezone than the one used on the site? Calendar apps often recalculate the time of an event based on the timezone in the .ics file to make sure that the event imports to the localized time. Is it possible that is what is happening here?
It would certainly be odd for there to be a full day difference in the time conversion, but it is possible depending on what the time is being localized to in the calendar app importing the event.
Let’s start there an see what we find.
Thanks!
GeoffAugust 21, 2015 at 9:13 am #997973CraigParticipantHi
Thanks for getting back
I am just importing it into my Calendar(OsX)
My timezone is set as BSTThe client has also had this error as well on machines that he has tried and this is into Outlook
I ran a few tests on the page, so not downloading the calendar and could see the issue occurring in this function wp_strtotime
Specifically this line of code in iCal.php line 368
$date = date_create( $string, new DateTimeZone( $tz ) ); if ( ! $date ) { return strtotime( $string ); } $date->setTimezone( new DateTimeZone( 'UTC' ) ); return $date->format( 'U' );
Cheers
Andy- This reply was modified 8 years, 8 months ago by Craig.
August 21, 2015 at 10:52 am #997991GeoffMemberHi Andy and thanks for following up!
Looking at the raw ical data:
DTSTART;VALUE=DATE:20150901 DTEND;VALUE=DATE:20150903
This actually seems to be correct considering that is how it would be rendered in plain UTC. If you’re using London time (UTC +1), then the raw data would need to show the three-day span, even if it’s interpreted as a single-day event by iCal (or any other calendar app). This makes sense because times in iCal have to be converted to UTC, meaning that the a date of X at 00:00 BST is the same day as X -1 at 23:00 UTC.
So, at least in terms of raw data, the output in the .ics is correct there. <span class=”s1″>It’s that +1 that makes it one day in advance on The Events Calendar but the conversion in the native app takes it back to two.</span>
You’re probably correct that the code you cited is where this is taking place. I think it is doing what it should be doing though, which is converting local time back to UTC for the purpose of importing the event to a calendar app in the localized time of that calendar.
Does that seem to make sense? W<span class=”s1″>e’re communicating a span of three days, but iCal just doesn’t see it that way.</span>
Geoff
August 24, 2015 at 1:43 am #998321CraigParticipantHi
Thanks for getting back
That kind of make sense but shouldn’t the conversion somehow allow for this
If I put a test calendar in iCal I getDTSTART;VALUE=DATE:20150902 DTEND;VALUE=DATE:20150904
Which is what I would expect
As it’s saying that start on 2nd and finish the beginning of the 4th so it will be 2nd -3rd inclusive as this is all-day eventsIf not how do we get around it as obviously it’s not giving the correct date at present no matter what setting I put in the timezone setting, so users are getting wrong dates
As you say in essence it’s this line
$date->setTimezone( new DateTimeZone( 'UTC' ) )
As this then puts it the day ahead at 23:00, which then iCal sees as the day beforeCheers
AndyAugust 24, 2015 at 7:59 am #998419GeoffMemberHey Andy, hope you had a great weekend!
This is certainly tricky because the plugin is doing what it should be doing (converting localized times back to UTC) so a calendar app can do what it needs to do (convert UTC to the end user’s settings).
We are in the midst of tidying up and refining out timezone support throughout the plugin, which is currently in testing. It’s quite possible that we may see some positive upside with this. I’ve noted this thread in that ticket so we can follow-up with you when it’s released, but please do keep your eyes open for it in the meantime and let’s see what impact that will have here.
Cheers!
GeoffAugust 24, 2015 at 8:20 am #998437CraigParticipantHi
Thanks for that
So in the meantime how do I get it so that whatever is specified as the date of the event (i.e. 2nd-3rd September) is what appears in the users calendar?
So ideally it’s irrelevant of their timezone as the events the client lists are all over the world so they wouldn’t be set to the same timezone as the website anywayCheers
AndyAugust 24, 2015 at 9:19 am #998462GeoffMemberHi Andy,
I’ve logged a ticket for our developers to take a look at this for you. I’m going to mark this thread as “Pending Fix” for now and will give you an update when we have some more to share. Definitely something we would like to check out further.
Thanks!
GeoffSeptember 3, 2015 at 11:25 am #1001714GeoffMemberHi Andy,
Here’s a snippet to try out in your theme’s functions.php file. I tested it out with an all-day two-day event (9/18-9/19) with my calendar set to BST and the event properly imported into my iCal calendar app as a two-day event that covers those same days. Let me know if it does the trick for you as well. 🙂
Thanks for your patience here!
Geoff
September 3, 2015 at 4:13 pm #1001893LeahMemberHello,
Thank you so much for reporting this. We are happy to tell you that a solution to this issue is part of our upcoming 3.12 release! We are doing the final testing and then the new version will be released. Keep an eye on your dashboard Updates page!
If you experience any difficulty with the update or find that the issue you reported in this thread is not resolved in 3.12, please open a new thread and we can help you. Thank you for your patience and support as we work to improve our plugins!
Best,
Leah
and The Events Calendar teamJune 21, 2018 at 7:59 am #1558293VictorKeymasterHi Craig!
Just wanted to share with you that a new release of our plugins is out, in which this issue is no longer present.
Find out more about this release → https://theeventscalendar.com/maintenance-release-for-the-week-of-27-may-2018/
Please update the plugins and see if it works for you. Don’t hesitate to open a new topic if anything comes up.
Best,
Victor -
AuthorPosts
- The topic ‘iCal not exporting the correct days’ is closed to new replies.