Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microsoft Outlook use different time zone id's #118

Open
Olafxso opened this issue Nov 7, 2019 · 6 comments
Open

Microsoft Outlook use different time zone id's #118

Olafxso opened this issue Nov 7, 2019 · 6 comments

Comments

@Olafxso
Copy link
Contributor

Olafxso commented Nov 7, 2019

Hi,

I want to import an .ics calendar from Microsoft Outlook

BEGIN:VCALENDAR
METHOD:PUBLISH
PRODID:Microsoft Exchange Server 2010
VERSION:2.0
X-WR-CALNAME:Agenda
BEGIN:VTIMEZONE
TZID:W. Europe Standard Time
BEGIN:STANDARD
DTSTART:16010101T030000
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T020000
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
UID:040000008200E00074C5B7101A82E008000000006686FB75C993D501000000000000000
 01000000007C1F67A981E724D83DDDD3B1FB05AA1
SUMMARY:fsdfs
DTSTART;TZID=W. Europe Standard Time:20191105T130000
DTEND;TZID=W. Europe Standard Time:20191105T180000
CLASS:PUBLIC
PRIORITY:5
DTSTAMP:20191107T121453Z
TRANSP:OPAQUE
STATUS:CONFIRMED
SEQUENCE:0
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-DONOTFORWARDMEETING:FALSE
X-MICROSOFT-DISALLOW-COUNTER:FALSE
END:VEVENT
BEGIN:VEVENT
UID:040000008200E00074C5B7101A82E0080000000048937278C993D501000000000000000
 0100000008542DE7D4319974697ADEAA9840EA5D3
SUMMARY:dfsdfsfs
DTSTART;TZID=W. Europe Standard Time:20191105T183000
DTEND;TZID=W. Europe Standard Time:20191105T220000
CLASS:PUBLIC
PRIORITY:5
DTSTAMP:20191107T121453Z
TRANSP:OPAQUE
STATUS:CONFIRMED
SEQUENCE:0
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-DONOTFORWARDMEETING:FALSE
X-MICROSOFT-DISALLOW-COUNTER:FALSE
END:VEVENT
END:VCALENDAR

An error occurs while parsing this file :

java.time.DateTimeException: Invalid ID for region-based ZoneId, invalid format: W. Europe Standard Time
	at java.time.ZoneRegion.checkName(ZoneRegion.java:151) ~[?:1.8.0_181]
	at java.time.ZoneRegion.ofId(ZoneRegion.java:116) ~[?:1.8.0_181]
	at java.time.ZoneId.of(ZoneId.java:411) ~[?:1.8.0_181]
	at java.time.ZoneId.of(ZoneId.java:359) ~[?:1.8.0_181]
	at jfxtras.icalendarfx.parameters.VParameterElement$20$1.fromString(VParameterElement.java:322) ~[jfxtras-icalendarfx.jar:?]
	at jfxtras.icalendarfx.parameters.VParameterBase.parseContent(VParameterBase.java:71) ~[jfxtras-icalendarfx.jar:?]
	at jfxtras.icalendarfx.VParentBase.processInLineChild(VParentBase.java:333) ~[jfxtras-icalendarfx.jar:?]
	at jfxtras.icalendarfx.properties.VPropertyBase.processInLineChild(VPropertyBase.java:474) ~[jfxtras-icalendarfx.jar:?]
	at jfxtras.icalendarfx.properties.VPropertyBase.lambda$6(VPropertyBase.java:434) ~[jfxtras-icalendarfx.jar:?]
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) ~[?:1.8.0_181]
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) ~[?:1.8.0_181]
	at jfxtras.icalendarfx.properties.VPropertyBase.parseContent(VPropertyBase.java:434) ~[jfxtras-icalendarfx.jar:?]
	at jfxtras.icalendarfx.VParentBase.parseContent(VParentBase.java:301) ~[jfxtras-icalendarfx.jar:?]
	at jfxtras.icalendarfx.VParentBase.parseContent(VParentBase.java:283) ~[jfxtras-icalendarfx.jar:?]

The RFC-5545 describes the syntax TZID is invalid also. So I don't think you code is wrong, but do you know about this? Do you know a workaround?

Thanks

@daviddbal
Copy link
Member

This problem is a result of the Java time library not identifying the time zone provided by Outlook - it's a non-standard time zone. Can you configure Outlook to provide a standard time zone?

@Olafxso
Copy link
Contributor Author

Olafxso commented Nov 7, 2019

There are no settings for generating the .ics file.

@daviddbal
Copy link
Member

How is the time zone set on the computer? Can the selection be made there?

@Olafxso
Copy link
Contributor Author

Olafxso commented Nov 7, 2019

No, It comes from the online version of outlook. So I don't think computer time zone settings will have effect.
It looks like windows uses a different TimeZone ID format. I found some mappings like here: https://unicode.org/cldr/charts/latest/supplemental/zone_tzid.html
Also newer Java version (I use java 8) are known about this format and have got a mapping file in 'jre\lib\tzmapping'

@daviddbal
Copy link
Member

Can you upgrade your Java version? If not, you can write a preprocessor that does a simple string substitution to replace the W. Europe Standard Time for a time zone that fits and Java 8 understands (e.g.TZID:Europe/London)

@Olafxso
Copy link
Contributor Author

Olafxso commented Nov 8, 2019

I cannot upgrade Java yet.
Is there a way to 'override' the TIME_ZONE_IDENTIFIER in jfxtras.icalendarfx.parameters.VParameterElement? Or add a custom property reader or something?

Or should I create a method which read the ics file to a string and replace all the possible strings.
There could by more than 100 possible zone ids. This will take some time I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants