From 491c5425242fdd10fb55319e46073c2447075eb1 Mon Sep 17 00:00:00 2001 From: Melissa Xie Date: Tue, 10 Aug 2021 00:11:05 +0000 Subject: [PATCH] Parse date parts as integers So that we can actually perform math. For some reason, JavaScript allowed "6" - 1 to equal 5 and so the `new Date` call just worked previously. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 4d66936..277ada7 100644 --- a/index.js +++ b/index.js @@ -25,7 +25,7 @@ async function run() { const results = datePattern.exec(issueTitle); if (results !== null) { - let [month, day, year] = results.slice(1); + let [month, day, year] = results.slice(1).map((part) => parseInt(part, 10)); // if the year is under 100, assume it's from the 2000s if (year < 100) {