diff --git a/changelogs/fragments/11206-datetime.yml b/changelogs/fragments/11206-datetime.yml new file mode 100644 index 0000000000..136c0edf4a --- /dev/null +++ b/changelogs/fragments/11206-datetime.yml @@ -0,0 +1,3 @@ +bugfixes: + - "datetime module utils - fix bug in ``fromtimestamp()`` that caused the function to crash. + This function is not used in community.general (https://github.com/ansible-collections/community.general/pull/11206)." diff --git a/plugins/module_utils/datetime.py b/plugins/module_utils/datetime.py index c7899f68da..e8e358dbad 100644 --- a/plugins/module_utils/datetime.py +++ b/plugins/module_utils/datetime.py @@ -22,8 +22,8 @@ def ensure_timezone_info(value): def fromtimestamp(value): if _USE_TIMEZONE: - return _datetime.fromtimestamp(value, tz=_datetime.timezone.utc) - return _datetime.utcfromtimestamp(value) + return _datetime.datetime.fromtimestamp(value, tz=_datetime.timezone.utc) + return _datetime.datetime.utcfromtimestamp(value) def now():