diff --git a/timers/receiptTimer.js b/timers/receiptTimer.js index dec5b12..7c5c5fb 100644 --- a/timers/receiptTimer.js +++ b/timers/receiptTimer.js @@ -23,9 +23,9 @@ module.exports = { lastMonday.setDate(today.getDate() - ((today.getDay() === 0) ? 6 : today.getDay() - 1)); const startDate = formatDate(lastMonday); - const nextMonday = new Date(lastMonday); - nextMonday.setDate(lastMonday.getDate() + 7); - const endDate = formatDate(nextMonday); + const nextSunday = new Date(lastMonday); + nextSunday.setDate(lastMonday.getDate() + 6); + const endDate = formatDate(nextSunday); // 0 1 2 3 4 5 6 // S M T W T F S let db = await client.localDB; @@ -35,7 +35,7 @@ module.exports = { const existingBudget = db.prepare(`SELECT id FROM weekly_budgets WHERE start_date = ?`).get(startDate); if (!existingBudget) { - await channel.send(`Format date last monday ${lastMonday} as startDate Format date next monday ${nextMonday} as endDate`); + await channel.send(`Format date last monday ${lastMonday} as startDate Format date next sunday ${nextSunday} as endDate`); await channel.send(`\`\`\`SELECT id FROM weekly_budgets WHERE start_date = ${startDate}\`\`\` ${JSON.stringify(existingBudget)}`); console.log(`No budget found for week starting ${startDate}.`); @@ -130,7 +130,7 @@ module.exports = { }, delay); const channel = await client.channels.fetch(timer.data.channelId); - if (channel) await channel.send(`Next message scheduled for: ${next.toLocaleString()} with ms delta of ${delay} / ${delay/3600000}`); + //if (channel) await channel.send(`Next message scheduled for: ${next.toLocaleString()} with ms delta of ${delay} / ${delay/3600000}`); console.log(`[TIMER] Next message scheduled for: ${next.toLocaleString()}`); } }; \ No newline at end of file