fix presence bug
[svn42.git] / grical-patchqueue / ical_endtime
1 # HG changeset patch
2 # Parent 054c3747b6957662fabfa7837ac78952d50be72c
3
4 diff -r 054c3747b695 grical/events/models.py
5 --- a/grical/events/models.py   Tue Aug 27 15:16:13 2013 +0200
6 +++ b/grical/events/models.py   Sun Dec 01 23:04:05 2013 +0100
7 @@ -1116,12 +1116,12 @@
8                  + unicode(self.id) + u'@' + \
9                  Site.objects.get_current().domain
10          # calculate DTEND
11 -        if self.enddate and self.enddate != self.startdate:
12 +        if (self.enddate and self.enddate != self.startdate) or (self.endtime and self.endtime != self.starttime):
13              # rfc2445 (iCalendar) indicates that:
14              # - DTEND can be omitted when equals DTSTART
15              # - DTEND specifies the non-inclusive end of the event
16 -            enddate = self.enddate + datetime.timedelta(days=1)
17              if self.endtime:
18 +                enddate = self.enddate if self.enddate else self.startdate
19                  date_time = datetime.datetime.combine(
20                          enddate, self.endtime )
21                  if self.timezone:
22 @@ -1130,7 +1130,7 @@
23                      date_time = loc_dt.astimezone( pytz.utc )
24                  vevent.add('DTEND').value = date_time
25              else:
26 -                vevent.add('DTEND').value = enddate
27 +                vevent.add('DTEND').value = self.enddate + datetime.timedelta(days=1)
28          # calculate DESCRIPTION
29          if self.description: vevent.add('DESCRIPTION').value = self.description
30          # see rfc5545 3.8.7.2. Date-Time Stamp