diff --git a/frontend/js/user/historical-graphs.js b/frontend/js/user/historical-graphs.js index 7e4c08a4..a8be9cfe 100644 --- a/frontend/js/user/historical-graphs.js +++ b/frontend/js/user/historical-graphs.js @@ -8,7 +8,9 @@ let currentView = "weekly"; document.addEventListener("DOMContentLoaded", () => { const currentPath = window.location.pathname; const pathSegments = currentPath.split("/"); - const currentUsername = pathSegments[pathSegments.length - 1]; + const currentUsername = + pathSegments[pathSegments.length - 1] || + pathSegments[pathSegments.length - 2]; const usernameHeading = document.getElementById("username-display"); if (usernameHeading) { diff --git a/scripts/sync-leaderboard.js b/scripts/sync-leaderboard.js index 03328f63..cf9f4623 100644 --- a/scripts/sync-leaderboard.js +++ b/scripts/sync-leaderboard.js @@ -170,7 +170,10 @@ async function getYesterdaySnapshot(filePath) { const repo = "leetcode-ranking-data"; const d = new Date(); d.setDate(d.getDate() - 1); - const targetDate = d.toISOString().split("T")[0]; + const year = d.getFullYear(); + const month = String(d.getMonth() + 1).padStart(2, "0"); + const date = String(d.getDate()).padStart(2, "0"); + const targetDate = `${year}-${month}-${date}`; const until = `${targetDate}T23:59:59Z`; const commitsUrl = `https://api.github.com/repos/${owner}/${repo}/commits?path=${filePath}&until=${until}&per_page=1`;