diff --git a/pykeepass/baseelement.py b/pykeepass/baseelement.py index 6e4e96f0..2ca238fa 100644 --- a/pykeepass/baseelement.py +++ b/pykeepass/baseelement.py @@ -19,7 +19,7 @@ def __init__(self, element, kp=None, icon=None, expires=False, self._element.append(E.IconID(icon)) current_time_str = self._kp._encode_time(datetime.now(timezone.utc)) if expiry_time: - expiry_time_str = self._kp._encode_time(expiry_time) + expiry_time_str = self._kp._encode_time(expiry_time.astimezone(timezone.utc)) else: expiry_time_str = current_time_str diff --git a/pykeepass/pykeepass.py b/pykeepass/pykeepass.py index f0131c1c..93eb71e9 100644 --- a/pykeepass/pykeepass.py +++ b/pykeepass/pykeepass.py @@ -28,7 +28,7 @@ BLANK_DATABASE_FILENAME = "blank_database.kdbx" BLANK_DATABASE_LOCATION = os.path.join(os.path.dirname(os.path.realpath(__file__)), BLANK_DATABASE_FILENAME) BLANK_DATABASE_PASSWORD = "password" -DT_ISOFORMAT = "%Y-%m-%dT%H:%M:%S%z" +DT_ISOFORMAT = "%Y-%m-%dT%H:%M:%S%fZ" class PyKeePass(): """Open a KeePass database @@ -795,7 +795,7 @@ def _encode_time(self, value): struct.pack('