Skip to content

Commit d28d221

Browse files
committed
add dtstamp to ical #669
1 parent ad92b91 commit d28d221

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/events/views.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ def calendar(request):
3333

3434
try:
3535
current_date = (
36-
date(int(year), int(month), 1)
37-
if month and year
38-
else timezone.localdate()
36+
date(int(year), int(month), 1) if month and year else timezone.localdate()
3937
)
4038
month, year = current_date.month, current_date.year
4139
except (ValueError, TypeError):
@@ -118,9 +116,11 @@ def download_calendar(_, token: str):
118116
)
119117
return HttpResponse(status=401)
120118

119+
now = timezone.now()
120+
121121
# Define default start and end date (from past 30 days to incoming 90 days)
122-
start_date = timezone.now().date() - timedelta(days=30)
123-
end_date = timezone.now().date() + timedelta(days=90)
122+
start_date = now.date() - timedelta(days=30)
123+
end_date = now.date() + timedelta(days=90)
124124

125125
# Retrieve release events
126126
releases = Event.objects.get_user_events(user, start_date, end_date)
@@ -137,6 +137,7 @@ def download_calendar(_, token: str):
137137
dt_tz_aware = release.datetime.replace(tzinfo=UTC)
138138
cal_event.add("dtstart", dt_tz_aware)
139139
cal_event.add("dtend", dt_tz_aware)
140+
cal_event.add("dtstamp", now)
140141
cal.add_component(cal_event)
141142

142143
# Return the iCal file

0 commit comments

Comments
 (0)