1
mirror of https://github.com/yt-dlp/yt-dlp synced 2024-12-11 22:23:56 +01:00

[utils] Fix parsing YYYYMMDD dates in Nov/Dec (#2094)

The date format `%Y%m%d%H%M` will successfully match against
one-digit month, day, hour, and minute strings, even though %m et al.
are documented as being zero-padded. So dates without time in
Nov/Dec may be wrongly parsed as dates in January with time.

This commit adds a format string of `%Y%m%d` to our supported date
format strings directly below (higher priority) its problematic relatives.

Closes #2076
Authored by: wlritchi
This commit is contained in:
Luc Ritchie 2021-12-23 15:34:01 -05:00 committed by GitHub
parent b28bac93ab
commit 4f3fa23e5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -210,6 +210,7 @@ DATE_FORMATS = (
'%Y/%m/%d %H:%M:%S',
'%Y%m%d%H%M',
'%Y%m%d%H%M%S',
'%Y%m%d',
'%Y-%m-%d %H:%M',
'%Y-%m-%d %H:%M:%S',
'%Y-%m-%d %H:%M:%S.%f',