Skip to content

Commit 53d66d8

Browse files
committed
Update item.py
1 parent 2c14a00 commit 53d66d8

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

stac_pydantic/item.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,16 @@ class ItemProperties(StacCommonMetadata):
1616
https://github.com/radiantearth/stac-spec/blob/v1.0.0/item-spec/item-spec.md#properties-object
1717
"""
1818

19-
datetime: Union[dt, str, None] = Field(..., alias="datetime")
19+
datetime: Optional[dt] = Field(..., alias="datetime")
2020

2121
@validator("datetime")
22-
def validate_datetime(cls, v: Union[dt, str, None], values: Dict[str, Any]) -> dt:
23-
if v in ("null", None):
22+
def validate_datetime(cls, v: Optional[dt], values: Dict[str, Any]) -> dt:
23+
if v is None:
2424
if not values["start_datetime"] and not values["end_datetime"]:
2525
raise ValueError(
2626
"start_datetime and end_datetime must be specified when datetime is null"
2727
)
2828

29-
if isinstance(v, str):
30-
return parse_datetime(v)
31-
3229
return v
3330

3431
class Config:

0 commit comments

Comments
 (0)