Skip to content

Commit b8671d6

Browse files
authored
compatible for more date format (#35487)
1 parent 6704033 commit b8671d6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scripts/release_helper/common.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,12 @@ def auto_bot_advice(self):
342342
def get_target_date(self):
343343
body = self.get_issue_body()
344344
try:
345-
self.target_date = [re.compile(r"\d{4}-\d{1,2}-\d{1,2}").findall(l)[0] for l in body if 'Target release date' in l][0]
345+
try:
346+
self.target_date = [re.compile(r"\d{4}-\d{1,2}-\d{1,2}").findall(l)[0] for l in body if 'Target release date' in l][0]
347+
except Exception:
348+
self.target_date = [re.compile(r"\d{1,2}/\d{1,2}/\d{4}").findall(l)[0] for l in body if 'Target release date' in l][0]
349+
self.target_date = datetime.strptime(self.target_date, "%m/%d/%Y").strftime('%Y-%m-%d')
350+
346351
self.date_from_target = int((time.mktime(time.strptime(self.target_date, '%Y-%m-%d')) - time.time()) / 3600 / 24)
347352
except Exception:
348353
self.target_date = 'fail to get.'

0 commit comments

Comments
 (0)