mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-04 20:32:45 +00:00
@@ -35,7 +35,7 @@ import uuid
|
||||
import yaml
|
||||
|
||||
from collections import MutableMapping, MutableSequence
|
||||
from datetime import datetime
|
||||
import datetime
|
||||
from functools import partial
|
||||
from random import Random, SystemRandom, shuffle
|
||||
|
||||
@@ -69,6 +69,8 @@ class AnsibleJSONEncoder(json.JSONEncoder):
|
||||
def default(self, o):
|
||||
if isinstance(o, HostVars):
|
||||
return dict(o)
|
||||
elif isinstance(o, (datetime.date, datetime.datetime)):
|
||||
return o.isoformat()
|
||||
else:
|
||||
return super(AnsibleJSONEncoder, self).default(o)
|
||||
|
||||
@@ -126,7 +128,7 @@ def to_bool(a):
|
||||
|
||||
|
||||
def to_datetime(string, format="%Y-%m-%d %H:%M:%S"):
|
||||
return datetime.strptime(string, format)
|
||||
return datetime.datetime.strptime(string, format)
|
||||
|
||||
|
||||
def strftime(string_format, second=None):
|
||||
|
||||
Reference in New Issue
Block a user