libera_utils.time.to_date#

libera_utils.time.to_date(value: str | date | datetime) → date#

Normalize a date-like value to its UTC calendar date.

Parameters:

value (str, datetime.date, or datetime) – An ISO 8601 date or datetime string, a datetime, or a date. A timezone-aware datetime is converted to UTC first; a naive one is taken as UTC.

Returns:

The UTC calendar date.

Return type:

datetime.date

Raises:

ValueError – If value is a string that is not ISO 8601.