AstraOS Ver. 1.47
All checks were successful
Deploy AstraOS Panel / deploy (push) Successful in 14s

Fix der Berechnung der Age Verification
This commit is contained in:
elias 2026-08-20 13:00:35 +02:00
parent bcaf8ae706
commit be33a1d4e1

View file

@ -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,