Skip to content

Commit

Permalink
fix utils.convert_datetime_str when None
Browse files Browse the repository at this point in the history
  • Loading branch information
JessyBarrette committed Aug 15, 2023
1 parent 91c749f commit d997e9b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ocean_data_parser/parsers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,12 @@ def get_spatial_coverage_attributes(
return ds


def convert_datetime_str(time_str, **to_datetime_kwargs):
def convert_datetime_str(time_str:str, **to_datetime_kwargs) -> pd.Timestamp:
"""Parse time stamp string to a pandas Timestamp"""
date_format = None
if time_str is None:
return pd.NaT

if re.fullmatch(r"\d\d\d\d-\d\d-\d\d", time_str):
date_format = "%Y-%m-%d"
elif re.fullmatch(r"\d\d-\d\d-\d\d\d\d", time_str):
Expand Down

0 comments on commit d997e9b

Please sign in to comment.