[Vobject] Problem with Timezones and iCalendar

Alexander Johannes alex at nirgal.de
Tue Jan 18 00:59:04 CST 2011


Hi,

Am 14.01.2011 um 12:15 schrieb Florian Heuberger:

> did you - or anyone else - find a solution for this
> vobject/serializing/pytz-issue?

Simple solution: don't use pytz, use python dateutil¹ instead. Vobject  
uses dateutil too and is apparently not compatible with pytz.

The Code should read something like the following (untested):

import datetime
import vobject
from dateutil.tz import *

dt = datetime.datetime(2010,7,1,10,0,0,0,gettz('Europe/Berlin'))

cal = vobject.iCalendar()
event = cal.add('vevent')
event.add('dtstart').value = dt

cal.serialize()

-----

The serialized Calendar should contain all the relevant timezone- 
information.

Alex

¹) <http://niemeyer.net/python-dateutil>



More information about the VObject mailing list