aind-data-schema
aind-data-schema copied to clipboard
last_modified field is losing it's timestamp in DocDB
Describe the bug
The created and last_modified fields use datetime
which doesn't require a timezone and somewhere between creation and upload to DocDB the last_modified field is losing it's timezone.
Also the comment in metadata.py
about creation/last_modified matching seems to be outdated:
# We'll set created and last_modified defaults using the root_validator
# to ensure they're synced on creation
created: datetime = Field(
default_factory=datetime.utcnow,
title="Created",
description="The utc date and time the data asset created.",
)
last_modified: datetime = Field(
default_factory=datetime.utcnow,
title="Last Modified",
description="The utc date and time that the data asset was last modified.",
)
Expected behavior Both fields could be changed to AwareDatetimeWithDefault to enforce timezone usage and their initial value should be set at the same time (or not if that doesn't actually matter)
Blocking #1086