datetime_from_db

safir.database.datetime_from_db(time)

Add the UTC time zone to a naive datetime from the database.

Parameters:

time (datetime | None) – The naive datetime from the database, or None.

Returns:

None if the input was none, otherwise a timezone-aware version of the same datetime in the UTC timezone.

Return type:

datetime.datetime or None