Skip to content

Commit

Permalink
Print parsed date for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
mxie authored Aug 10, 2021
1 parent 3ed90e8 commit 5b13f10
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,22 @@ async function run() {
if (results !== null) {
let [month, day, year] = results.slice(1);

// in case it's a 2-digit year
// if the year is under 100, assume it's from the 2000s
if (year < 100) {
year += 2000;
}

const issueDate = new Date(year, month - 1, day);

console.log(`Date found in title: ${issueDate.toDateString()}`)

if (issueDate < today) {
octokit.issues.update({
...ghContext.repo,
issue_number: issueNumber,
state: "closed",
});

console.log(`Closed #${issue.number}.`);

issuesClosed++;
Expand Down

0 comments on commit 5b13f10

Please # to comment.