1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-12-13 11:45:29 +00:00

[devalue] fromisoformat is no good pre-3.11

Authored by: bashonly
This commit is contained in:
bashonly
2025-06-11 02:48:22 -05:00
parent fb332f6908
commit 9de99f569d

View File

@@ -6,6 +6,8 @@ import datetime as dt
import math
import re
from .._utils import parse_iso8601
TYPE_CHECKING = False
if TYPE_CHECKING:
import collections.abc
@@ -87,7 +89,7 @@ def parse_iter(parsed: typing.Any, /, *, revivers: dict[str, collections.abc.Cal
elif value[0] == 'Date':
try:
result = dt.datetime.fromisoformat(value[1])
result = dt.datetime.fromtimestamp(parse_iso8601(value[1]), tz=dt.timezone.utc)
except Exception:
yield ValueError(f'invalid date: {value[1]!r}')
result = None