Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ def test_is_weaviate_too_old(version: str, too_old: bool):
),
# Test handling year 0 (should return datetime.min)
("0000-01-15T14:30:45.123456Z", datetime.min),
# Test empty string (protobuf default for unset string field)
("", datetime.min),
],
)
def test_datetime_from_weaviate_str(input_str: str, expected: datetime) -> None:
Expand Down
2 changes: 2 additions & 0 deletions weaviate/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,8 @@ def _datetime_to_string(value: TIME) -> str:


def _datetime_from_weaviate_str(string: str) -> datetime.datetime:
if not string:
return datetime.datetime.min
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't "None" be a better return here?

If we have properties I would expect None if it is unset in Weaviate

if string[-1] != "Z":
string = "".join(string.rsplit(":", 1))

Expand Down