Skip to content

Commit 98ed032

Browse files
authored
Update reminder.js
1 parent 8bfe430 commit 98ed032

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

.github/scripts/reminder.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const PAT_TOKEN = process.env.PAT_TOKEN;
22
const [REPO_OWNER, REPO_NAME] = process.env.GITHUB_REPOSITORY.split("/");
3+
const today = new Date().toISOString().split("T")[0];
34

45
async function getIssues() {
56
const query =
@@ -85,10 +86,8 @@ async function addComment(issueNumber, comment) {
8586
});
8687
}
8788

88-
function isTodayBetween(start, end) {
89-
if (!start || !end) return false;
90-
91-
const currentDate = new Date().toISOString().split("T")[0];
89+
function isDateBetween(date, start, end) {
90+
const currentDate = new Date(date);
9291
const startDate = new Date(start);
9392
const endDate = new Date(end);
9493

@@ -104,7 +103,7 @@ async function reminder() {
104103
}
105104

106105
for (const issue of issues) {
107-
if (!isTodayBetween(issue.start, issue.end)) {
106+
if (!isDateBetween(today, issue.start, issue.end)) {
108107
console.log(`No comments for issue #${issue.number}: ${issue.title}`);
109108
continue;
110109
}

0 commit comments

Comments
 (0)