Replace deprecated datetime.utcnow()
The datetime.utcnow() is deprecated in Python 3.12. Replace datetime.utcnow() with datetime.now(datetime.timezone.utc).replace(tzinfo=None). Change-Id: I4be5425e7fdb94a6235677d5639c0633f7ff229a Signed-off-by: Takashi Natsume <takanattie@gmail.com>
This commit is contained in:
parent
7fae0387a0
commit
1e5fe0ef4e
@ -223,7 +223,8 @@ class CreateForm(forms.SelfHandlingForm):
|
||||
datetime.timezone.utc)
|
||||
cleaned_data['start_date'] = start
|
||||
else:
|
||||
cleaned_data['start_date'] = datetime.datetime.utcnow()
|
||||
cleaned_data['start_date'] = datetime.datetime.now(
|
||||
datetime.timezone.utc).replace(tzinfo=None)
|
||||
if cleaned_data['end_date']:
|
||||
end = cleaned_data['end_date']
|
||||
end = end.replace(tzinfo=local).astimezone(datetime.timezone.utc)
|
||||
|
Loading…
Reference in New Issue
Block a user