mirror of
https://github.com/EDeev/y.calendarkin.git
synced 2026-06-18 22:11:02 +03:00
v. 1.2
This commit is contained in:
parent
ee078546b7
commit
5106ee455c
1 changed files with 11 additions and 1 deletions
|
|
@ -38,8 +38,18 @@ def text_ical(user_id, tz):
|
||||||
r_rule = component.get('rrule')
|
r_rule = component.get('rrule')
|
||||||
if r_rule:
|
if r_rule:
|
||||||
list_rrule = icalendar.vRecur.to_ical(r_rule).decode('utf-8').split(';')
|
list_rrule = icalendar.vRecur.to_ical(r_rule).decode('utf-8').split(';')
|
||||||
|
|
||||||
|
until, u_flag = [elem for elem in list_rrule if 'UNTIL' in elem], True
|
||||||
list_rrule = [elem for elem in list_rrule if 'UNTIL' not in elem]
|
list_rrule = [elem for elem in list_rrule if 'UNTIL' not in elem]
|
||||||
|
|
||||||
|
if until:
|
||||||
|
until_old = until[0].split('=')[1]
|
||||||
|
until = isoparse(until_old).replace(tzinfo=None)
|
||||||
|
|
||||||
|
if until.replace(tzinfo=None) <= date.replace(tzinfo=None):
|
||||||
|
until, u_flag = "UNTIL=" + until_old, False
|
||||||
|
|
||||||
|
if u_flag:
|
||||||
until = "UNTIL=" + "".join(date.date().isoformat().split("-")) + "T235900Z"
|
until = "UNTIL=" + "".join(date.date().isoformat().split("-")) + "T235900Z"
|
||||||
|
|
||||||
list_rrule.append(until)
|
list_rrule.append(until)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue