1
0
Fork 0
mirror of https://github.com/blackjack4494/yt-dlc.git synced 2024-12-21 23:33:10 +00:00

[utils] Handle rd-suffixed day parts in unified_strdate (#23199)

This commit is contained in:
InfernalUnderling 2019-11-26 17:08:37 +00:00 committed by Sergey M
parent cf3c9eafad
commit 9d30c2132a
2 changed files with 5 additions and 0 deletions

View file

@ -340,6 +340,8 @@ class TestUtil(unittest.TestCase):
self.assertEqual(unified_strdate('July 15th, 2013'), '20130715') self.assertEqual(unified_strdate('July 15th, 2013'), '20130715')
self.assertEqual(unified_strdate('September 1st, 2013'), '20130901') self.assertEqual(unified_strdate('September 1st, 2013'), '20130901')
self.assertEqual(unified_strdate('Sep 2nd, 2013'), '20130902') self.assertEqual(unified_strdate('Sep 2nd, 2013'), '20130902')
self.assertEqual(unified_strdate('November 3rd, 2019'), '20191103')
self.assertEqual(unified_strdate('October 23rd, 2005'), '20051023')
def test_unified_timestamps(self): def test_unified_timestamps(self):
self.assertEqual(unified_timestamp('December 21, 2010'), 1292889600) self.assertEqual(unified_timestamp('December 21, 2010'), 1292889600)

View file

@ -1718,13 +1718,16 @@ DATE_FORMATS = (
'%B %d %Y', '%B %d %Y',
'%B %dst %Y', '%B %dst %Y',
'%B %dnd %Y', '%B %dnd %Y',
'%B %drd %Y',
'%B %dth %Y', '%B %dth %Y',
'%b %d %Y', '%b %d %Y',
'%b %dst %Y', '%b %dst %Y',
'%b %dnd %Y', '%b %dnd %Y',
'%b %drd %Y',
'%b %dth %Y', '%b %dth %Y',
'%b %dst %Y %I:%M', '%b %dst %Y %I:%M',
'%b %dnd %Y %I:%M', '%b %dnd %Y %I:%M',
'%b %drd %Y %I:%M',
'%b %dth %Y %I:%M', '%b %dth %Y %I:%M',
'%Y %m %d', '%Y %m %d',
'%Y-%m-%d', '%Y-%m-%d',