validatorfuncs.future must create utcnow() time-aware so comparison with generated datetime can be done.

This commit is contained in:
Henddher Pedroza 2019-10-16 20:11:59 -04:00
parent 0244518aac
commit 7f14d3a167
2 changed files with 12 additions and 12 deletions

View file

@ -121,7 +121,7 @@ def duration(entry, option_key="Duration", **kwargs):
def future(entry, option_key="Future Datetime", from_tz=None, **kwargs):
time = datetime(entry, option_key, from_tz=from_tz)
if time < _dt.datetime.utcnow():
if time < _dt.datetime.utcnow().replace(tzinfo=_dt.timezone.utc):
raise ValueError(f"That {option_key} is in the past! Must give a Future datetime!")
return time