mirror of
https://gitea.phreedom.club/localhost_frssoft/FMN_bot.git
synced 2025-05-13 15:28:43 +00:00
some fix, well fucked up gregorian calendar...
This commit is contained in:
parent
e696eaa375
commit
9b1fc812d4
2 changed files with 13 additions and 5 deletions
|
@ -8,8 +8,16 @@ def check_stop_thread_scan(suggested_date):
|
|||
suggested_year = suggested_date.year
|
||||
tuesdays = []
|
||||
for i in calendar.Calendar().itermonthdays4(suggested_year, suggested_month):
|
||||
print(i)
|
||||
if i[3] == 1 and datetime.datetime(year=i[0], month=i[1], day=i[2]) > suggested_date:
|
||||
tuesdays.append(datetime.datetime(
|
||||
year=i[0], month=i[1], day=i[2], hour=hour_poll_posting))
|
||||
if tuesdays == []:
|
||||
shift_for_next_week = suggested_date + datetime.timedelta(days=1)
|
||||
suggested_month = shift_for_next_week.month
|
||||
suggested_year = shift_for_next_week.year
|
||||
for i in calendar.Calendar().itermonthdays4(suggested_year, suggested_month):
|
||||
if i[3] == 1 and datetime.datetime(year=i[0], month=i[1], day=i[2]) > suggested_date:
|
||||
tuesdays.append(datetime.datetime(
|
||||
year=i[0], month=i[1], day=i[2], hour=hour_poll_posting))
|
||||
|
||||
return tuesdays[0] # near tuesday
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue