Skip to content

Commit dfa6af0

Browse files
Parse Session dates according to expected format
Issue #82
1 parent 6a0db86 commit dfa6af0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/openlifu/db/session.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import xarray
88
import json
99

10+
DATE_FORMAT = "%d-%b-%Y %H:%M:%S"
11+
1012
@dataclass
1113
class Session:
1214
"""
@@ -70,9 +72,9 @@ def from_dict(d):
7072
:returns: Session object
7173
"""
7274
if 'date' in d:
73-
d['date'] = datetime.fromisoformat(d['date'])
75+
d['date'] = datetime.strptime(d['date'],DATE_FORMAT)
7476
if 'date_modified' in d:
75-
d['date_modified'] = datetime.fromisoformat(d['date_modified'])
77+
d['date_modified'] = datetime.strptime(d['date_modified'],DATE_FORMAT)
7678
if isinstance(d['volume'], dict):
7779
d['volume'] = xarray.DataArray.from_dict(d['volume'])
7880
if isinstance(d['transducer'], dict):

0 commit comments

Comments
 (0)