Skip to content

Commit

Permalink
Use date parse function for P3.6 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
ekuler committed Jan 4, 2024
1 parent 8059716 commit cc74ae4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pykeepass/pykeepass.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

class PyKeePass():
"""Open a KeePass database
Expand Down Expand Up @@ -810,9 +810,9 @@ def _decode_time(self, text):
)
)
except BinasciiError:
return datetime.fromisoformat(text).astimezone(timezone.utc)
return datetime.strptime(text, DT_ISOFORMAT).astimezone(timezone.utc)
else:
return datetime.fromisoformat(text).astimezone(timezone.utc)
return datetime.strptime(text, DT_ISOFORMAT).astimezone(timezone.utc)

def create_database(
filename, password=None, keyfile=None, transformed_key=None
Expand Down

0 comments on commit cc74ae4

Please sign in to comment.