Skip to content

Commit

Permalink
Empty date string and format not supported on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjstewart committed Sep 14, 2021
1 parent 6c5504c commit 9279eb5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
1 change: 0 additions & 1 deletion tests/datasets/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ def test_invalid_t(self) -> None:
@pytest.mark.parametrize(
"date_string,format,min_datetime,max_datetime",
[
("foo", "", datetime(1970, 1, 1).timestamp(), datetime.max.timestamp()),
(
"2021",
"%Y",
Expand Down
6 changes: 1 addition & 5 deletions torchgeo/datasets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,7 @@ def disambiguate_timestamp(date_str: str, format: str) -> Tuple[float, float]:

# TODO: This is really tedious, is there a better way to do this?

if not any([f"%{c}" in format for c in "yYcxG"]):
# No temporal info
mint = datetime(1970, 1, 1)
maxt = datetime.max
elif not any([f"%{c}" in format for c in "bBmjUWcxV"]):
if not any([f"%{c}" in format for c in "bBmjUWcxV"]):
# Year resolution
maxt = datetime(mint.year, 12, 31, 23, 59, 59, 999999)
elif not any([f"%{c}" in format for c in "djcx"]):
Expand Down

0 comments on commit 9279eb5

Please sign in to comment.