From 35474e5df4ca07397dd212a8c0fba359362ea8a4 Mon Sep 17 00:00:00 2001 From: cottongin Date: Mon, 23 Mar 2026 01:40:07 -0400 Subject: [PATCH] feat: add archived column to sessions table and isSunday helper Made-with: Cursor --- backend/database.js | 7 +++++++ frontend/src/utils/dateUtils.js | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/backend/database.js b/backend/database.js index bbdb8f3..867539f 100644 --- a/backend/database.js +++ b/backend/database.js @@ -56,6 +56,13 @@ function initializeDatabase() { ) `); + // Add archived column if it doesn't exist (for existing databases) + try { + db.exec(`ALTER TABLE sessions ADD COLUMN archived INTEGER DEFAULT 0`); + } catch (err) { + // Column already exists, ignore error + } + // Session games table db.exec(` CREATE TABLE IF NOT EXISTS session_games ( diff --git a/frontend/src/utils/dateUtils.js b/frontend/src/utils/dateUtils.js index 3d226c2..9d4f131 100644 --- a/frontend/src/utils/dateUtils.js +++ b/frontend/src/utils/dateUtils.js @@ -47,3 +47,12 @@ export function formatLocalDateTime(sqliteTimestamp) { return parseUTCTimestamp(sqliteTimestamp).toLocaleString(); } +/** + * Check if a SQLite timestamp falls on a Sunday (in local timezone) + * @param {string} sqliteTimestamp + * @returns {boolean} + */ +export function isSunday(sqliteTimestamp) { + return parseUTCTimestamp(sqliteTimestamp).getDay() === 0; +} +