diff --git a/server/src/routes/paychecks.js b/server/src/routes/paychecks.js index 88711e9..ccd9472 100644 --- a/server/src/routes/paychecks.js +++ b/server/src/routes/paychecks.js @@ -97,9 +97,7 @@ async function buildVirtualPaychecks(year, month) { try { for (const plan of activePlans.rows) { // Skip plans that haven't started yet for this period - const start = new Date(plan.start_date); - const planStartYear = start.getFullYear(); - const planStartMonth = start.getMonth() + 1; + const [planStartYear, planStartMonth] = plan.start_date.split('-').map(Number); if (year * 12 + month < planStartYear * 12 + planStartMonth) continue; const amount = await calcPaymentAmount(client, plan, year, month); @@ -202,9 +200,7 @@ async function generatePaychecks(year, month) { ); for (const plan of activePlans.rows) { // Skip plans that haven't started yet for this period - const start = new Date(plan.start_date); - const planStartYear = start.getFullYear(); - const planStartMonth = start.getMonth() + 1; + const [planStartYear, planStartMonth] = plan.start_date.split('-').map(Number); if (year * 12 + month < planStartYear * 12 + planStartMonth) continue; // Determine which paycheck(s) this plan applies to