mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-20 03:18:30 +00:00
[devalue] fromisoformat
is no good pre-3.11
Authored by: bashonly
This commit is contained in:
parent
fb332f6908
commit
9de99f569d
@ -6,6 +6,8 @@
|
|||||||
import math
|
import math
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from .._utils import parse_iso8601
|
||||||
|
|
||||||
TYPE_CHECKING = False
|
TYPE_CHECKING = False
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
import collections.abc
|
import collections.abc
|
||||||
@ -87,7 +89,7 @@ def parse_iter(parsed: typing.Any, /, *, revivers: dict[str, collections.abc.Cal
|
|||||||
|
|
||||||
elif value[0] == 'Date':
|
elif value[0] == 'Date':
|
||||||
try:
|
try:
|
||||||
result = dt.datetime.fromisoformat(value[1])
|
result = dt.datetime.fromtimestamp(parse_iso8601(value[1]), tz=dt.timezone.utc)
|
||||||
except Exception:
|
except Exception:
|
||||||
yield ValueError(f'invalid date: {value[1]!r}')
|
yield ValueError(f'invalid date: {value[1]!r}')
|
||||||
result = None
|
result = None
|
||||||
|
Loading…
Reference in New Issue
Block a user