Merge pull request #1617 from pieterhijma/honor-start-end-expand
Honor start end expand
This commit is contained in:
@@ -303,6 +303,10 @@ def _expand(
|
|||||||
# then in the response we return the date, not datetime
|
# then in the response we return the date, not datetime
|
||||||
dt_format = '%Y%m%d'
|
dt_format = '%Y%m%d'
|
||||||
|
|
||||||
|
duration = None
|
||||||
|
if hasattr(item.vobject_item.vevent, "dtend"):
|
||||||
|
duration = item.vobject_item.vevent.dtend.value - item.vobject_item.vevent.dtstart.value
|
||||||
|
|
||||||
expanded_item, rruleset = _make_vobject_expanded_item(item, dt_format)
|
expanded_item, rruleset = _make_vobject_expanded_item(item, dt_format)
|
||||||
|
|
||||||
if rruleset:
|
if rruleset:
|
||||||
@@ -319,6 +323,15 @@ def _expand(
|
|||||||
name='RECURRENCE-ID',
|
name='RECURRENCE-ID',
|
||||||
value=recurrence_utc.strftime(dt_format), params={}
|
value=recurrence_utc.strftime(dt_format), params={}
|
||||||
)
|
)
|
||||||
|
vevent.dtstart = ContentLine(
|
||||||
|
name='DTSTART',
|
||||||
|
value=recurrence_utc.strftime(dt_format), params={}
|
||||||
|
)
|
||||||
|
if duration:
|
||||||
|
vevent.dtend = ContentLine(
|
||||||
|
name='DTEND',
|
||||||
|
value=(recurrence_utc + duration).strftime(dt_format), params={}
|
||||||
|
)
|
||||||
|
|
||||||
if is_expanded_filled is False:
|
if is_expanded_filled is False:
|
||||||
expanded.vevent = vevent
|
expanded.vevent = vevent
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ BEGIN:VTIMEZONE
|
|||||||
LAST-MODIFIED:20040110T032845Z
|
LAST-MODIFIED:20040110T032845Z
|
||||||
TZID:US/Eastern
|
TZID:US/Eastern
|
||||||
BEGIN:DAYLIGHT
|
BEGIN:DAYLIGHT
|
||||||
DTSTART:20000404
|
DTSTART:20000404T020000
|
||||||
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
|
RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
|
||||||
TZNAME:EDT
|
TZNAME:EDT
|
||||||
TZOFFSETFROM:-0500
|
TZOFFSETFROM:-0500
|
||||||
TZOFFSETTO:-0400
|
TZOFFSETTO:-0400
|
||||||
END:DAYLIGHT
|
END:DAYLIGHT
|
||||||
BEGIN:STANDARD
|
BEGIN:STANDARD
|
||||||
DTSTART:20001026
|
DTSTART:20001026T020000
|
||||||
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
|
RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
|
||||||
TZNAME:EST
|
TZNAME:EST
|
||||||
TZOFFSETFROM:-0400
|
TZOFFSETFROM:-0400
|
||||||
|
|||||||
@@ -1715,7 +1715,7 @@ permissions: RrWw""")
|
|||||||
recurrence_ids.append(line)
|
recurrence_ids.append(line)
|
||||||
|
|
||||||
if line.startswith("DTSTART:"):
|
if line.startswith("DTSTART:"):
|
||||||
assert line == "DTSTART:20060102T170000Z"
|
assert line in ["DTSTART:20060103T170000Z", "DTSTART:20060104T170000Z"]
|
||||||
|
|
||||||
assert len(uids) == 2
|
assert len(uids) == 2
|
||||||
assert len(set(recurrence_ids)) == 2
|
assert len(set(recurrence_ids)) == 2
|
||||||
@@ -1802,10 +1802,10 @@ permissions: RrWw""")
|
|||||||
recurrence_ids.append(line)
|
recurrence_ids.append(line)
|
||||||
|
|
||||||
if line.startswith("DTSTART:"):
|
if line.startswith("DTSTART:"):
|
||||||
assert line == "DTSTART:20060102"
|
assert line in ["DTSTART:20060103", "DTSTART:20060104", "DTSTART:20060105"]
|
||||||
|
|
||||||
if line.startswith("DTEND:"):
|
if line.startswith("DTEND:"):
|
||||||
assert line == "DTEND:20060103"
|
assert line in ["DTEND:20060104", "DTEND:20060105", "DTEND:20060106"]
|
||||||
|
|
||||||
assert len(uids) == 3
|
assert len(uids) == 3
|
||||||
assert len(set(recurrence_ids)) == 3
|
assert len(set(recurrence_ids)) == 3
|
||||||
|
|||||||
Reference in New Issue
Block a user