diff --git a/flask_saml2/idp/sphandler.py b/flask_saml2/idp/sphandler.py index fee4300..5e61d2a 100644 --- a/flask_saml2/idp/sphandler.py +++ b/flask_saml2/idp/sphandler.py @@ -290,7 +290,7 @@ def format_datetime(self, value: datetime.datetime) -> str: formatting, and don't support the format produced by :meth:`datetime.datetime.isoformat`. """ - return value.isoformat() + return value.replace(tzinfo=None).isoformat(timespec='seconds') def __str__(self): if self.display_name: diff --git a/flask_saml2/sp/idphandler.py b/flask_saml2/sp/idphandler.py index 50788ad..c93d2c8 100644 --- a/flask_saml2/sp/idphandler.py +++ b/flask_saml2/sp/idphandler.py @@ -266,7 +266,7 @@ def format_datetime(self, value: datetime.datetime) -> str: formatting, and don't support the format produced by :meth:`datetime.datetime.isoformat`. """ - return value.isoformat() + return value.replace(tzinfo=None).isoformat(timespec='seconds') + 'Z' def __str__(self): if self.display_name: