We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 795833f commit ba97659Copy full SHA for ba97659
Lib/email/_parseaddr.py
@@ -47,9 +47,16 @@ def parsedate_tz(data):
47
Accounts for military timezones.
48
"""
49
data = data.split()
50
- if data[0][-1] in (',', '.') or data[0].lower() in _daynames:
+ # The FWS after the comma after the day-of-week is optional, so search and
51
+ # adjust for this.
52
+ if data[0].endswith(',') or data[0].lower() in _daynames:
53
# There's a dayname here. Skip it
54
del data[0]
55
+ else:
56
+ i = data[0].rfind(',')
57
+ if i < 0:
58
+ return None
59
+ data[0] = data[0][i+1:]
60
if len(data) == 3: # RFC 850 date, deprecated
61
stuff = data[0].split('-')
62
if len(stuff) == 3:
0 commit comments