Getting UTC timestamps of iCal with Timezone
See original GitHub issueI have some iCal-data with a timezone-definition (Europe/Copenhagen
; CET
/CEST
), but I can’t get the dates specified in this timezone out in UTC.
Roughly:
BEGIN:VTIMEZONE
TZID:Europe/Copenhagen
...
END:VTIMEZONE
BEGIN:VEVENT
...
DTSTART;TZID=Europe/Copenhagen:20131120T113000
...
END:VEVENT
When I parse it, I it seem to believe the UTC-offset is 0, no matter how I poke at it.
event = new ICAL.Event(
ICAL.Component(ICAL.Parse(DATA)[1]).getFirstSubcomponent('vevent')
);
event.startDate.toJSDate();
// In computer localtime.
event.startDate.utcOffset();
// 0 - should be 1 or 2 hours, depending on summertime.
console.log(event.startDate);
{ wrappedJSObject: [Circular],
_time:
{ year: 2013,
month: 11,
day: 20,
hour: 11,
minute: 30,
second: 0,
isDate: false },
_pendingNormalization: false,
timezone: 'Europe/Copenhagen',
zone:
{ wrappedJSObject: [Circular],
expandedUntilYear: 0,
changes: [],
tzid: 'floating' } }
Can anyone give some pointers as to what I’m doing wrong?
Also: How do I generate startTime and endTime with timezone-definitions? ICAL.Time.fromData({...}, iCalTz)
doesn’t add the timezone-definition…
Issue Analytics
- State:
- Created 10 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Getting UTC timestamps of iCal with Timezone #102 - GitHub
I have some iCal-data with a timezone-definition ( Europe/Copenhagen ; CET / CEST ), but I can't get the dates specified in this...
Read more >Create ical with timezone using utc offset instead of time zone ...
in my database i'm storing datetimes in UTC with additional column timezone offset as time zone instead of timezone name ...
Read more >iCalendar spec: 4.3.5 Date-Time - The Web KANZAKI
In most cases, a fixed time is desired. To properly communicate a fixed time in a property value, either UTC time or local...
Read more >ZDateHelper - iCalendar.org
... "UTC") : integer. Return current Unix timestamp in local timezone ... $tzid = "UTC"). Date math: add or substract from current date...
Read more >Org-Mode iCalendar Export with Explicit Time Zones | Tero Hasu
It is existing Org behavior to translate non-"UTC" TIMEZONE specifying date-time timestamps into RFC 5545 DATE-TIME values in the “DATE WITH ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It turns out the parser doesn’t hook up the timestamps with
TZID:<name>
to the correspondingVTIMEZONE
. If I monkey-patch ex. thestartDate
w.startDate.zone = new ICAL.Timezone(comp.getFirstSubcomponent('vtimezone'));
it works fine.Anyone had any further thoughts on this? It’s still the case that when you make a toJSDate() call, the TZID value in a VEVENT is ignored. This makes that call currently fairly useless without some hackery.