Starting with stac-fastapi v4.0, the datetime attribute in BaseSearchGetRequest, ItemCollectionUri, and BaseCollectionSearchGetRequest models has changed from a Python datetime.datetime type to a string type. This ensures the attribute matches the validation behavior of Pydantic models. When receiving a GET request, the datetime value passed to your client implementation will now be a string (the raw user input) rather than a parsed datetime object.
To work with parsed dates, use the .parse_datetime(), .start_date, and .end_date methods provided by the request models.
from stac_fastapi.types.search import BaseSearchGetRequest
import datetime
# For an Interval (e.g., "start/end")
search = BaseSearchGetRequest(datetime="2020-01-01T00:00:00.00001Z/2020-01-02T00:00:00.00001Z")
search.parse_datetime()
print(search.start_date) # datetime.datetime(2020, 1, 1, ...)
print(search.end_date) # datetime.datetime(2020, 1, 2, ...)
# For a Single date
search = BaseSearchGetRequest(datetime="2020-01-01T00:00:00.00001Z")
search.parse_datetime()
print(search.start_date) # datetime.datetime(2020, 1, 1, ...)
print(search.end_date) # None