Timezones not working for calendar event - icalendar

I am having difficulties with timezones in an event. This is the contents of the event, and it's specifying the event with a TZID. I am being told however that when people in Central timezone add it, it appears as 2PM rather then intended 1PM. I am in ET so not able to test this.
Do you know why it would be happening?
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//http://XXX//Event
METHOD:PUBLISH
BEGIN:VEVENT
DTSTART;TZID="America/Chicago":20150811T130000
DTEND;TZID="America/Chicago":20150811T141500
SUMMARY:Test Event
DESCRIPTION:Test Event
LOCATION:Test Event Location
END:VEVENT
END:VCALENDAR

See RFC5545, Time Zone Component and Time Zone Identifier: you need to add a VTIMEZONE component to your calendar file where you definea TZID so that you can refer to it in your VEVENT.
Parameter Name: TZID
This parameter MUST be specified on the "DTSTART",
"DTEND", "DUE", "EXDATE", and "RDATE" properties when either a
DATE-TIME or TIME value type is specified and when the value is
neither a UTC or a "floating" time. Failure to include and follow VTIMEZONE definitions in iCalendar objects may lead to inconsistent understanding of the local time
at any given location.
It should be noted that while Outlook/Exchange have repeatedly been reported to not require the VTIMEZONE, failure to include a VTIMEZONE leads to unpredictable behaviour from other calendars.

Related

Org icalendar export : don't make tickler for one hour

When exporting an org mode file to .ics, everything works fine.
The problem is not with the export, but with the length of time that an event that takes place at a specific time (without an end date) lasts (This is what I call a "tickler" (event to be checked or thought of at some point)).
The time duration is 2 hours, which is much too long for a tickler.
Here is an example: 
* Try of tickler <2022-06-09 Thu 22:00> Description
BEGIN:VEVENT
DTSTAMP:20220609T202654Z
UID:TS1-940a4198-e83d-4bf0-b839-baa1bdb36e54
DTSTART:20220609T200000
DTEND:20220609T220000
SUMMARY:Try of tickler
DESCRIPTION:<2022-06-09 Thu 22:00> \nDescription
END:VEVENT
Why does org-mode work like this? Can we reduce the duration of the time? Thanks in advance for your answers

I cannot figure out what date format this is

I've got these ical files I'm trying to process and they come with microsoft teams links. The invites have this very strange format for the date that I just can't figure out. I thought it was UTC but I still can't seem to figure it out. Any calendaring program opens it just fine, showing me the correct date. But I want to process the text.
Here is an example:
BEGIN:VCALENDAR
METHOD:REQUEST
PRODID:Microsoft Exchange Server 2010
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Central Standard Time
BEGIN:STANDARD
DTSTART:16010101T020000
TZOFFSETFROM:-0500
TZOFFSETTO:-0600
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T020000
TZOFFSETFROM:-0600
TZOFFSETTO:-0500
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
END:DAYLIGHT
END:VTIMEZONE
This one in particular converts to October 27, 2021 at 3:00pm Central Daylight time. I could process things another way, but I have to satisfy my curiosity here. I tried to look at the RFC for ICS but I haven't seen what I'm looking for.
Those are daylight saving changes for the timezone component. https://datatracker.ietf.org/doc/html/rfc5545#section-3.6.5
"DTSTART" in this usage MUST be specified as a date with a local time value.
For local time value, see Form#1 for DATETIME https://datatracker.ietf.org/doc/html/rfc5545#page-33

Getting timezone abbreviations in Swift

I am trying to retrieve the timezone abbreviations of the local time zone by using the following code.
private func getLocalTimezone() -> String {
guard let localTimezone = TimeZone.current.abbreviation() else {
return ""
}
return localTimezone
}
But when I am in Indian time zone I am always getting GMT+5:30 where I need it as IST. Its coming correctly when I am in CST or PST. Can anyone please suggest a way to reach to the solution for this issue.
Thanks a lot in advance
This is because time zone abbreviations are locale sensitive. IST only means India Standard Time (Asia/Kolkata) in India. In other parts of the world, it could mean Israel Standard Time, or Irish Standard/Summer Time. Here's a site that shows you the list of abbreviations. You can see for yourself how ambiguous they can be.
This is why abbreviation() takes into account the region of your phone, i.e. this setting:
abbreviation() will give you "IST" if your device's region is India. If your phone is somewhere else, it shows "GMT+5:30" because that is the safest, most unambiguous option.
If you want it to output IST no matter where your device is, you need to hard code this by creating a dictionary of time zone identifiers to abbreviations that you want. There is a built in abbreviationDictionary that goes the other way - abbreviations to identifiers. You can search it, and it will work for IST (Asia/Kolkata), but might not work for whatever other time zone that you are interested in.
let abbreviation = TimeZone.abbreviationDictionary
.first(where: { $1 == TimeZone.current.identifier })?.key
and I'm not sure whether the contents of this dictionary will stay the same in future versions of iOS. Use it at your own risk.

iCal STANDARD or DAYLIGHT error when already defined

I have an iCal file that I am validating here
https://icalendar.org/validator.html?url=https://www.youreontime.com/calendar/syncstaff/d72e6edb-90da-4cc7-86c0-16fee6f3ad2e
It is giving an error At least one STANDARD or DAYLIGHT property must be defined here near line # 4
Here is the file which does have a time zone section at the top.
BEGIN:VCALENDAR
PRODID:-//github.com/rianjs/ical.net//NONSGML ical.net 4.0//EN
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Australia/Sydney
X-LIC-LOCATION:Australia/Sydney
END:VTIMEZONE
BEGIN:VEVENT
ATTENDEE;CN=Adriane Bews;ROLE=REQ-PARTICIPANT:MAILTO:demo#youreontime.com
DESCRIPTION:Walter Jones (Ph 12456788) Dry off. Staff Adriane Bews
DTEND;TZID=Australia/Sydney:20200215T133500
DTSTAMP:20200215T105625Z
DTSTART;TZID=Australia/Sydney:20200215T132000
SEQUENCE:0
STATUS:TENTATIVE
SUMMARY:Walter Jones Dry off
UID:yot-10025135
END:VEVENT
END:VCALENDAR
Craig, Evan pointed you in the right direction.
What the message is saying is that "AT LEAST ONE STANDARD OR DAYLIGHT PROPERTY" must be defined IF one defines a VTIMEZONE. A VTIMEZONE is a full definition of the timezone for the period of your events -ie if there is daylight saving, then one must define when there is a changeover, as per the example
BEGIN:VTIMEZONE
TZID:US-Eastern
LAST-MODIFIED:19870101T000000Z
BEGIN:STANDARD
DTSTART:19971026T020000
RDATE:19971026T020000
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
TZNAME:EST
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:19971026T020000
RDATE:19970406T020000
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
TZNAME:EDT
END:DAYLIGHT
END:VTIMEZONE
Personally I think it would be great if one were able to assume that both one's own system and the receiving system had the latest Olson database timezone definitions and thus that any recurring events would end up with the same day & time. However I supposed there is no guarantee of that, so the VTIMEZONE allows one to define the daylight saving changes etc that one's system is using.
Many systems may accept ics files without VTIMEZONES BUT they are supposed to be there and correctly defined.

Icalendar dates problem - my date is out by 2 days

I have a calendar file which I will post below. The problem is that when I load this into outlook the date says the 24/02/2011. The date in the file as shown below is the 22/02/2011
(START:201102*22*T100000).
I am in Sydney/Australia if that makes any difference.
Can anyone try adding this to their outlook calendars and see if the date is wrong?
Here is a link to the file: http://www.onlinerego.com/small_business_summit2011/assets/template/ics/sydney.ics
Thanks so much.
BEGIN:VCALENDAR
PRODID:-//http://testing.cdw/thegoldbook///NONSGML kigkonsult.se iCalcreator 2.8//EN
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
UID:20110208T111839EST-4800GDFvWN#http://testing.cdw/thegoldbook/
DTSTAMP:20110208T000239Z
DESCRIPTION;LANGUAGE=en:Thank you for registering to attend the 'Trend Micr
o Affinity Partner Small Business Summit 2011'.\n\nWe look forward to seei
ng you at the event!\n\nDate: 22 February\nVenue: Novotel Darling Harbour\
, Terrace Room\nAddress: 100 Murray St\, Darling Harbour\nArrival time: 10
:00am\n\nAgenda\n10.00am - Pre registration & Networking\n10.30am - Exploi
ting Small Business Trends to increase your profits\, By Toby Lee\, Global
Vice President\, Volume Business Unit\, Trend Micro\n11.00am - Product Ro
admap for Small Business\, By Richard Ku\, Global Vice President\, Small B
usiness Product Management\, Trend Micro\n11.15am - Break\n11.45am - Affin
ity Program and Channel Engagement Update\, By Malcolm Pooley\, ANZ Small
Business Channel Sales Manager\n12.00pm - Q&A Panel\n12.15pm - Close\n\nUR
L - http://www.onlinerego.com/small_business_summit2011/thankyou.php?city=
Sydney
DTSTART:20110222T100000
DTEND:20110222T121500
LOCATION;LANGUAGE=en:Novotel Darling Harbour\, Terrace Room\, 100 Murray St
\, Darling Harbour
SUMMARY;LANGUAGE=en:Trend Micro Affinity Partner Small Business Summit 2011
URL:http://www.onlinerego.com/small_business_summit2011/thankyou.php?city=S
ydney
END:VEVENT
END:VCALENDAR
I'm also in Aus.
Loading into my google (sydney time) gives Tue, 22 February, 21:00 – 23:15 - so wrong times but right date. Google may assume it is UTC time and are we currently +11, that may explain it's time. No idea what outlook is doing.
windows calendar has 22 feb and 10 am
my own app also gives 22 Feb and 10 am
The way dates are specified and whether you have a timezone or not makes a difference.
The file does not have a timezone spec and the dates are specified in "local" format - ie: should translate to 10 am in whatever timezone you load it into ... dangerous as if it were a conference call meeting across timezones for eg, it should have a timezone associated with it.
Either in the DTSTART
DTSTART;TZID=America/New_York:20101031T190000
or using the X-WR-TIMEZONE custom field
X-WR-TIMEZONE:America/New_York
Sorry no idea what outlook is doing though (I do not use it).