@@ -22,10 +22,10 @@ def first_tuesday(year, month):
2222 return first + dt .timedelta (days = days_ahead )
2323
2424
25- def upcoming_meetings (today ):
25+ def upcoming_meetings (today , count ):
2626 meetings = []
2727 year , month = today .year , today .month
28- while len (meetings ) < 6 : # Max of six meeting entries
28+ while len (meetings ) < count :
2929 meeting_date = first_tuesday (year , month )
3030 if meeting_date >= today :
3131 meetings .append ((meeting_date , utc_hour (meeting_date )))
@@ -36,12 +36,27 @@ def upcoming_meetings(today):
3636 return meetings
3737
3838
39+ def past_meetings (today , count ):
40+ meetings = []
41+ year , month = today .year , today .month
42+ while len (meetings ) < count :
43+ meeting_date = first_tuesday (year , month )
44+ if meeting_date < today :
45+ meetings .append ((meeting_date , utc_hour (meeting_date )))
46+ month -= 1
47+ if month < 1 :
48+ month = 12
49+ year -= 1
50+ meetings .reverse ()
51+ return meetings
52+
53+
3954class MeetingDatesDirective (SphinxDirective ):
4055 has_content = False
4156
4257 def run (self ):
4358 bullets = nodes .bullet_list ()
44- for date , hour in upcoming_meetings (dt .date .today ()):
59+ for date , hour in upcoming_meetings (dt .date .today (), 6 ):
4560 item = nodes .list_item ()
4661 text = f"{ date .strftime ('%B %d, %Y' )} - { hour :02d} :00 UTC"
4762 url = f"https://arewemeetingyet.com/UTC/{ date .isoformat ()} /{ hour } :00/Docs Community Meeting"
@@ -64,11 +79,15 @@ def generate_ics(app, exception):
6479 "VERSION:2.0" ,
6580 "PRODID:-//Python Docs Community//Meeting Dates//EN" ,
6681 ]
67- for date , hour in upcoming_meetings (dt .date .today ()):
82+ today = dt .date .today ()
83+ meetings = past_meetings (today , 12 ) + upcoming_meetings (today , 12 )
84+ for date , hour in meetings :
6885 start = dt .datetime (date .year , date .month , date .day , hour , 0 , 0 )
6986 end = start + dt .timedelta (hours = 1 )
7087 lines += [
7188 "BEGIN:VEVENT" ,
89+ f"UID:{ start .strftime ('%Y%m%dT%H%M%SZ' )} @python-docs-community" ,
90+ f"DTSTAMP:{ dt .datetime .now (dt .timezone .utc ).strftime ("%Y%m%dT%H%M%SZ" )} " ,
7291 f"DTSTART:{ start .strftime ('%Y%m%dT%H%M%SZ' )} " ,
7392 f"DTEND:{ end .strftime ('%Y%m%dT%H%M%SZ' )} " ,
7493 "SUMMARY:Docs Community Meeting" ,
0 commit comments