fix(subscription): ceil day count so bought N days shows 'N дн.'
- seconds // 86400 floored to N-1 (bought 10 -> showed 9); use ceil instead - concrete MSK expiry time stays only for the last day (< 24h remaining)
This commit is contained in:
1 parent
9400050ade
commit
261b2b2d02
2 files changed
+4
-3
No files matched your search
+3
-2
@@ -199,8 +199,9 @@ def subscription_time_left(
|
||||
if seconds <= 0:
|
||||
return False, 0, ""
|
||||
if seconds >= 86400:
|
||||
return True, seconds // 86400, "дн."
|
||||
# Меньше суток — показываем конкретное время окончания вместо "N ч.".
|
||||
# Округляем вверх: купленные N дней показываем как "N дн.", а не "N-1".
|
||||
return True, -(-seconds // 86400), "дн."
|
||||
# Меньше суток (последний день) — показываем конкретное время окончания вместо "N ч.".
|
||||
display_tz = display_tz or MSK_TIMEZONE
|
||||
stamp = (expires + datetime.timedelta(microseconds=1)).replace(tzinfo=datetime.timezone.utc)
|
||||
return True, stamp.astimezone(display_tz).strftime("%d.%m.%Y %H:%M") + " (МСК)", ""
|
||||
|
||||
Reference in new issue
Block a user