What did VTIMEZONE use for icalendar? Why not just UTC time?

What is VTIMEZONE used for icalendar?

eg. 1

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Apple Inc.//Mac OS X 10.12.3//EN
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Asia/Shanghai
BEGIN:STANDARD
TZOFFSETFROM:+0900
RRULE:FREQ=YEARLY;UNTIL=19910914T150000Z;BYMONTH=9;BYDAY=3SU
DTSTART:19890917T000000
TZNAME:GMT+8
TZOFFSETTO:+0800
END:STANDARD
BEGIN:DAYLIGHT
TZOFFSETFROM:+0800
DTSTART:19910414T000000
TZNAME:GMT+8
TZOFFSETTO:+0900
RDATE:19910414T000000
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
TRANSP:OPAQUE
LAST-MODIFIED:20170305T083916Z
UID:gjo1burcjnsib4p2j8tbbv4hh0@google.com
DTSTAMP:20170305T083916Z
LOCATION:Cell Group
DESCRIPTION:
STATUS:CONFIRMED
SEQUENCE:0
SUMMARY:Study Bible
DTSTART;TZID=Asia/Shanghai:20170324T193000
DTEND;TZID=Asia/Shanghai:20170324T213000
X-APPLE-TRAVEL-ADVISORY-BEHAVIOR:AUTOMATIC
CREATED:20160312T140632Z
RRULE:FREQ=WEEKLY;BYDAY=FR
BEGIN:VALARM
X-WR-ALARMUID:9B47E27E-9063-417E-B488-409387A3201A
UID:9B47E27E-9063-417E-B488-409387A3201A
TRIGGER;VALUE=DATE-TIME:19760401T005545Z
ACKNOWLEDGED:20161125T105826Z
X-APPLE-DEFAULT-ALARM:TRUE
ACTION:NONE
END:VALARM
END:VEVENT
END:VCALENDAR

      

From iCalendar Documentation

VTIMEZONE: Provides a grouping of component properties that defines the time zone.

1. What is the definition of VTIMEZONE?

Is there a rule for describing winter time and daylight saving time for a location?

2. What is VTIMEZONE used for?

I don't need to specify the VTIMEZONE component in the icalendar object. Instead, I shift my local time to utc and export the icalendar event.

# Before
DTSTART:20170324T113000Z
DTEND:20170324T130000

# After
DTSTART;TZID=Asia/Shanghai:20170324T193000
DTEND;TZID=Asia/Shanghai:20170324T213000

      

2.1 Does this make sense? icalendar object without VTIMEZONE

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Apple Inc.//Mac OS X 10.12.3//EN
BEGIN:VEVENT
TRANSP:OPAQUE
LAST-MODIFIED:20170305T083916Z
UID:gjo1burcjnsib4p2j8tbbv4hh0@google.com
DTSTAMP:20170305T083916Z
LOCATION:Cell Group
DESCRIPTION:
STATUS:CONFIRMED
SEQUENCE:0
SUMMARY:Study Bible
DTSTART;TZID=Asia/Shanghai:20170324T113000
DTEND;TZID=Asia/Shanghai:20170324T213000
X-APPLE-TRAVEL-ADVISORY-BEHAVIOR:AUTOMATIC
CREATED:20160312T140632Z
RRULE:FREQ=WEEKLY;BYDAY=FR
BEGIN:VALARM
X-WR-ALARMUID:9B47E27E-9063-417E-B488-409387A3201A
UID:9B47E27E-9063-417E-B488-409387A3201A
TRIGGER;VALUE=DATE-TIME:19760401T005545Z
ACKNOWLEDGED:20161125T105826Z
X-APPLE-DEFAULT-ALARM:TRUE
ACTION:NONE
END:VALARM
END:VEVENT
END:VCALENDAR

      

2.2 If this makes sense, what is the use of VTIMEZONE?

3. Consistency between VTIMEZONE and VEVENT

Take for example. 1, for example.

....
BEGIN:VTIMEZONE
TZID:Asia/Shanghai                           <- Part 1
.....
END:VTIMEZONE


BEGIN:VEVENT
....
DTSTART;TZID=Asia/Shanghai:20170324T193000   <- Part 2
DTEND;TZID=Asia/Shanghai:20170324T213000     <- Part 3
....
END:VEVENT

      

3.1. Does the timezone in VEVENT have to match VTIMEZONE?

3.2 Can I use a different time zone to describe the time in part2 and part3?

eg.

....
BEGIN:VTIMEZONE
TZID:Asia/Shanghai                           <- Part 1
.....
END:VTIMEZONE


BEGIN:VEVENT
....
DTSTART:20170324T193000Z   <- Part 2 UTC time
DTEND:20170324T213000Z     <- Part 3 UTC Time
....
END:VEVENT

      

+3


source to share


1 answer


1. What is the definition of VTIMEZONE?

VTIMEZONE is used to store specific UTC offset rules that the time zone points to at any given time (i.e. when is daylight saving time and when is standard time).

2. What is VTIMEZONE used for?

Used when you want to format your entire iCalendar timestamps in a specific time zone instead of UTC.

You may ask: Why not just use UTC everywhere? Wouldn't that be easier? Answer: The time zone is necessary because of the repetition rules . If you have a recurring event and the event crosses the daily / standard boundary, you need to specify the time zone for that event. If you just used UTC, the event time will become incorrect as soon as you pass the daylight / standard boundary.

2.1 Does this make sense? icalendar object without VTIMEZONE

Your example is wrong.

The DTEND property in your example refers to a VTIMEZONE component that does not exist (Asia / Shanghai).

DTEND;TZID=Asia/Shanghai:20170324T213000

      



The iCalendar parser will look at this TZID and then look for a VTIMEZONE component whose TZID property matches it. Since your iCalendar object does not have such a VTIMEZONE, the iCalendar parser technically does not know how to interpret this date. The TZID parameter is simply considered a unique identifier. It doesn't matter in itself.

If you want the date to be formatted in a specific time zone, but you do not want to include the VTIMEZONE component in your iCalendar object, you can use the global time zone identifier . Global time zone identifiers differ from normal TZID parameters because they start with a forward slash :

DTEND;TZID=/Asia/Shanghai:20170324T213000

      

The downside to global timezone identifiers is that the iCalendar specification does NOT specify how these identifiers should be interpreted by the parser. In practice, however, I would assume that out of all the parsers that support globals, most probably refer to them as Olson IDs.

3.1. Does the timezone in VEVENT have to match VTIMEZONE?

The time zone (s) defined in the VTIMEZONE component (s) are globally scoped in the iCalendar object. Therefore, any TZID parameter in VEVENT must reference the VTIMEZONE component (unless it is a global time zone identifier).

3.2 Can I use a different time zone to describe the time in part2 and part3?

Just because your iCalendar object has a VTIMEZONE component doesn't mean you should use it. Your example is valid.

+4


source







All Articles