Fix der Berechnung der Age Verification
This commit is contained in:
parent
bcaf8ae706
commit
be33a1d4e1
|
|
@ -1423,8 +1423,12 @@ def age_verification():
|
|||
|
||||
result = {'age': age, 'steam_id': steam_id}
|
||||
if age < 13:
|
||||
thirteenth_birthday = birthdate_dt.replace(year=birthdate_dt.year + 13)
|
||||
ban_duration_days = (thirteenth_birthday - today).days + 1
|
||||
try:
|
||||
thirteenth_birthday = birthdate_dt.replace(year=birthdate_dt.year + 13)
|
||||
except ValueError:
|
||||
# 29. Feb in einem Nicht-Schaltjahr → auf 1. März ausweichen
|
||||
thirteenth_birthday = birthdate_dt.replace(year=birthdate_dt.year + 13, month=3, day=1)
|
||||
ban_duration_days = (thirteenth_birthday - today).days
|
||||
result['ban_duration_days'] = ban_duration_days
|
||||
result['ban_command'] = f"oban {steam_id} {ban_duration_days}d"
|
||||
|
||||
|
|
@ -1469,8 +1473,12 @@ def view_user_age_details(user_id):
|
|||
birthdate_dt = datetime.strptime(user['birthdate'], '%d.%m.%Y')
|
||||
except ValueError:
|
||||
birthdate_dt = datetime.strptime(user['birthdate'], '%Y-%m-%d')
|
||||
thirteenth_birthday = birthdate_dt.replace(year=birthdate_dt.year + 13)
|
||||
ban_duration_days = (thirteenth_birthday - today).days + 1
|
||||
try:
|
||||
thirteenth_birthday = birthdate_dt.replace(year=birthdate_dt.year + 13)
|
||||
except ValueError:
|
||||
# 29. Feb in einem Nicht-Schaltjahr → auf 1. März ausweichen
|
||||
thirteenth_birthday = birthdate_dt.replace(year=birthdate_dt.year + 13, month=3, day=1)
|
||||
ban_duration_days = (thirteenth_birthday - today).days
|
||||
if ban_duration_days > 0:
|
||||
result = {
|
||||
'ban_duration_days': ban_duration_days,
|
||||
|
|
|
|||
Loading…
Reference in a new issue