By qwertzuiopstefan1 on Tuesday, 15 November 2016
Replies 14
Likes 0
Views 3K
Votes 0
Hi!

I've already searched through the forum but didn't find a solution.

My problem is that I've got an Office 365 ics link with the attribute set
TZID: (UTC+01:00) Amsterdam\, Berlin\, Bern\, Rom\, Stockholm\, Wien


when i try to add a new calendar saying it should take all the new appointments from the .ics link I have, I get the following error message:
DateTimeZone::__construct(): Unknown or bad timezone ((UTC+01)


so what can I do against this problem? Can I convert this .ics file or the attributes that are needed to GMT timezone?

Thanks in regards!

best wishes
Hello,

That's not a standard timezone format so you will need to add it in to JEvents file:

components/com_jevents/libraries/iCalImport.php

See for example:

You would add for example:

$wtzdata["(UTC+01"] = "Europe/Amsterdam";
$wtzdata["(UTC+01:00) Amsterdam\, Berlin\, Bern\, Rom\, Stockholm\, Wien"] = "Europe/Amsterdam";
·
8 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Hi, thanks for the fast respond!

I tried the following in this file which didn't work:


/////////////////// SELF ADDED BEGIN ///////////////////
$wtzdata["(UTC+01:00) Amsterdam, Berlin, Bern, Rom, Stockholm, Wien"] = "Europe/Amsterdam";
$wtzdata["Amsterdam\, Berlin\, Bern\, Rom\, Stockholm\, Wien"] = "Europe/Amsterdam";
$wtzdata["Amsterdam, Berlin, Bern, Rom, Stockholm, Wien"] = "Europe/Amsterdam";
$wtzdata["UTC+01:00 Amsterdam\, Berlin\, Bern\, Rom\, Stockholm\, Wien"] = "Europe/Amsterdam";
$wtzdata["UTC+01:00 Amsterdam, Berlin, Bern, Rom, Stockholm, Wien"] = "Europe/Amsterdam";
$wtzdata["(UTC+01:00)"] = "Europe/Amsterdam";
$wtzdata["UTC+01:00"] = "Europe/Amsterdam";
/////////////////// SELF ADDED END ///////////////////


Your solution with the

$wtzdata["(UTC+01"] = "Europe/Amsterdam";
works now. Thanks...

but.... now i get new error...:

DateTime::__construct(): Failed to parse time string (00) Amsterdam, Berlin, Bern, Rom, Stockholm, Wien"20161014T190000) at position 0 (0): Unexpected character


that's how the ics looks like (part from it):

BEGIN:VEVENT
DESCRIPTION:some description
UID:some UID
SUMMARY:some summary
DTSTART;TZID="(UTC+01:00) Amsterdam, Berlin, Bern, Rom, Stockholm, Wien":2016
1014T190000
DTEND;TZID="(UTC+01:00) Amsterdam, Berlin, Bern, Rom, Stockholm, Wien":201610
14T210000
CLASS:PUBLIC
PRIORITY:5
DTSTAMP:20161115T104921Z
TRANSP:OPAQUE
STATUS:CONFIRMED
SEQUENCE:0
LOCATION:some location
X-MICROSOFT-CDO-APPT-SEQUENCE:0
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
X-MICROSOFT-CDO-IMPORTANCE:1
X-MICROSOFT-CDO-INSTTYPE:0
X-MICROSOFT-DISALLOW-COUNTER:FALSE
END:VEVENT


any ideas?
·
8 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
the : is a special character in the iCal format so I'm VERY surprised at Microsoft allowing it in a timezone id.

change line 2234 of components/com_jevents/libraries/iCalImport.php from

$matches = explode(":",$vcLine,2);

to
				$matches = explode(":",$vcLine,3);                                
// Catch some bad Microsoft timezones e.g. "(UTC+01:00) Amsterdam, Berlin, Bern, Rom, Stockholm, Wien"
if (count($matches) == 3) {
$matches[0] = $matches[0].":".$matches[1];
$matches[1] = $matches[2];
unset($matches[2]);
}


and it should resolve the issue
·
8 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Well, thank you really for your help!!

Now I get no error in the backed.
Sadly Every appointment gets imported on every single day, see attachment....

Before I posted my question into this forum, I tried with the search & replace funktion to replace all this UTC crap with 'GMT Standard Time' and created a calendar with uploading the ics file from my computer. This solution worked fine. Every appointment was on its day - obviously with the wrong time....

I hope I don't waste your time helping me....
·
8 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Can you provide a full copy of your iCal file?
·
8 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
I'll send you a priv. message :-)
·
8 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Please adjust Geraints replacement code to:


$matches = explode(":",$vcLine,3);
// Catch some bad Microsoft timezones e.g. "(UTC+01:00) Amsterdam, Berlin, Bern, Rom, Stockholm, Wien"
if (count($matches) == 3) {
$matches[0] = $matches[0];
$matches[1] = $matches[2];
unset($matches[2]);
}


And run again.
·
8 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Now it works like it should!

Thank you very much!! :-)

So for the next update I'll have to add/replace the code again, right?
·
8 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Yep I'm afraid so!

Many thanks
Tony
·
8 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
No - I'll actually include it in the next release since it won't harm anyone else.
·
8 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Okay, thank you very much! :-)
·
8 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
p.s. Remember to add your custom timezone in the file components/com_jevents/libraries/ical_custom_timezones.php as

<?php
$wtzdata["UTC+01:00 Amsterdam, Berlin, Bern, Rom, Stockholm, Wien"] = "Europe/Amsterdam";
·
8 years ago
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post