One small change to serialize_datetime

This commit is contained in:
ChoiHwaa 2022-06-18 00:53:21 +01:00 committed by GitHub
parent 2776df5192
commit 9e0dd88d6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,11 +132,11 @@ class TLObject:
elif isinstance(dt, float): elif isinstance(dt, float):
dt = int(dt) dt = int(dt)
elif isinstance(dt, timedelta): elif isinstance(dt, timedelta):
dt = int(dt.total_seconds()) dt = int((datetime.now() + dt).timestamp())
except OSError: except OSError:
dt = 0 dt = 0
# 2145916800 is the date 2038, 1, 1. # 2145916800 is the date 2038-01-01.
if dt > 2145916800: if dt > 2145916800:
raise ValueError("Date is outside the range of valid values.") raise ValueError("Date is outside the range of valid values.")