diff --git a/aries_cloudagent/messaging/tests/test_util.py b/aries_cloudagent/messaging/tests/test_util.py index 23614b511e..c1a7e7c82b 100644 --- a/aries_cloudagent/messaging/tests/test_util.py +++ b/aries_cloudagent/messaging/tests/test_util.py @@ -55,7 +55,7 @@ def test_format(self): tests = { datetime( 2019, 5, 17, 20, 51, 19, 519437, tzinfo=timezone.utc - ): "2019-05-17 20:51:19.519437Z", + ): "2019-05-17T20:51:19.519437Z", now: now, } for datetime_val, expected in tests.items(): diff --git a/aries_cloudagent/messaging/util.py b/aries_cloudagent/messaging/util.py index d100d4adab..a5e28b15a1 100644 --- a/aries_cloudagent/messaging/util.py +++ b/aries_cloudagent/messaging/util.py @@ -21,7 +21,7 @@ def datetime_to_str(dt: Union[str, datetime]) -> str: dt: May be a string or datetime to allow automatic conversion """ if isinstance(dt, datetime): - dt = dt.replace(tzinfo=timezone.utc).isoformat(" ").replace("+00:00", "Z") + dt = dt.replace(tzinfo=timezone.utc).isoformat().replace("+00:00", "Z") return dt