@@ -390,10 +390,14 @@ def get_clan_games_start(time: Optional[datetime] = None) -> datetime:
390390 if time is None :
391391 time = datetime .utcnow ()
392392 month = time .month
393+ year = time .year
393394 this_months_cg_end = datetime (year = time .year , month = time .month , day = 28 , hour = 8 , minute = 0 , second = 0 )
394- if time > this_months_cg_end :
395+ if time > this_months_cg_end and month < 12 :
395396 month += 1
396- return datetime (year = time .year , month = month , day = 22 , hour = 8 , minute = 0 , second = 0 )
397+ elif time > this_months_cg_end : # we're at the end of December
398+ month = 1
399+ year += 1
400+ return datetime (year = year , month = month , day = 22 , hour = 8 , minute = 0 , second = 0 )
397401
398402
399403def get_clan_games_end (time : Optional [datetime ] = None ) -> datetime :
@@ -419,10 +423,14 @@ def get_clan_games_end(time: Optional[datetime] = None) -> datetime:
419423 if time is None :
420424 time = datetime .utcnow ()
421425 month = time .month
426+ year = time .year
422427 this_months_cg_end = datetime (year = time .year , month = time .month , day = 28 , hour = 8 , minute = 0 , second = 0 )
423- if time > this_months_cg_end :
428+ if time > this_months_cg_end and month < 12 :
424429 month += 1
425- return datetime (year = time .year , month = month , day = 28 , hour = 8 , minute = 0 , second = 0 )
430+ elif time > this_months_cg_end : # we're in December
431+ month = 1
432+ year += 1
433+ return datetime (year = year , month = month , day = 28 , hour = 8 , minute = 0 , second = 0 )
426434
427435
428436def get_raid_weekend_start (time : Optional [datetime ] = None ) -> datetime :
0 commit comments