fix(tkpurchase): 일정 목록 미표시 버그 수정 — 캐시·타임존·페이지네이션
- API에 Cache-Control: no-store 미들웨어 추가 (304 캐시 문제 해결) - toLocalDate() 유틸 추가, 전체 8개 JS의 toISOString 타임존 버그 수정 - scheduleModel.findAll에 total COUNT 추가, 컨트롤러에서 total 반환 - HTML 캐시 버스팅 ?v=2026031601 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -104,7 +104,7 @@ function openAddAccount() {
|
||||
// Default expiration: 1 year from now
|
||||
const oneYear = new Date();
|
||||
oneYear.setFullYear(oneYear.getFullYear() + 1);
|
||||
document.getElementById('addExpiresAt').value = oneYear.toISOString().substring(0, 10);
|
||||
document.getElementById('addExpiresAt').value = toLocalDate(oneYear);
|
||||
document.getElementById('addAccountModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,12 @@ function showToast(msg, type = 'success') {
|
||||
/* ===== Escape ===== */
|
||||
function escapeHtml(str) { if (!str) return ''; const d = document.createElement('div'); d.textContent = str; return d.innerHTML; }
|
||||
|
||||
/* ===== Local Date (timezone-safe) ===== */
|
||||
function toLocalDate(d) {
|
||||
if (!(d instanceof Date) || isNaN(d)) return '';
|
||||
return `${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,'0')}-${String(d.getDate()).padStart(2,'0')}`;
|
||||
}
|
||||
|
||||
/* ===== Helpers ===== */
|
||||
function formatDate(d) { if (!d) return ''; return String(d).substring(0, 10); }
|
||||
function formatTime(d) { if (!d) return ''; return String(d).substring(11, 16); }
|
||||
|
||||
@@ -65,7 +65,7 @@ async function loadTodaySchedules() {
|
||||
} catch(e) { console.warn(e); }
|
||||
}
|
||||
|
||||
function todayStr() { return new Date().toISOString().substring(0, 10); }
|
||||
function todayStr() { return toLocalDate(new Date()); }
|
||||
|
||||
function initDashboard() {
|
||||
if (!initAuth()) return;
|
||||
|
||||
@@ -99,7 +99,7 @@ function openAddDayLabor() {
|
||||
// Default to tomorrow
|
||||
const tomorrow = new Date();
|
||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||
document.getElementById('addWorkDate').value = tomorrow.toISOString().substring(0, 10);
|
||||
document.getElementById('addWorkDate').value = toLocalDate(tomorrow);
|
||||
document.getElementById('addDayLaborModal').classList.remove('hidden');
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ function initDayLaborPage() {
|
||||
// Set default date range to this month
|
||||
const now = new Date();
|
||||
const firstDay = new Date(now.getFullYear(), now.getMonth(), 1);
|
||||
document.getElementById('filterDateFrom').value = firstDay.toISOString().substring(0, 10);
|
||||
document.getElementById('filterDateTo').value = now.toISOString().substring(0, 10);
|
||||
document.getElementById('filterDateFrom').value = toLocalDate(firstDay);
|
||||
document.getElementById('filterDateTo').value = toLocalDate(now);
|
||||
loadDayLabor();
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ function initPartnerHistory() {
|
||||
const today = new Date();
|
||||
const thirtyDaysAgo = new Date(today);
|
||||
thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
|
||||
document.getElementById('filterDateTo').value = today.toISOString().substring(0, 10);
|
||||
document.getElementById('filterDateFrom').value = thirtyDaysAgo.toISOString().substring(0, 10);
|
||||
document.getElementById('filterDateTo').value = toLocalDate(today);
|
||||
document.getElementById('filterDateFrom').value = toLocalDate(thirtyDaysAgo);
|
||||
|
||||
loadHistory();
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ async function renderScheduleCards() {
|
||||
const requestCardsEl = document.getElementById('requestCards');
|
||||
const workRequestFormEl = document.getElementById('workRequestForm');
|
||||
|
||||
const today = new Date().toISOString().substring(0, 10);
|
||||
const today = toLocalDate(new Date());
|
||||
|
||||
if (!portalSchedules.length) {
|
||||
container.innerHTML = '';
|
||||
|
||||
@@ -177,7 +177,7 @@ async function openAddSchedule() {
|
||||
document.getElementById('addCompanyId').value = '';
|
||||
const tomorrow = new Date();
|
||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||
const tomorrowStr = tomorrow.toISOString().substring(0, 10);
|
||||
const tomorrowStr = toLocalDate(tomorrow);
|
||||
document.getElementById('addStartDate').value = tomorrowStr;
|
||||
document.getElementById('addEndDate').value = tomorrowStr;
|
||||
await loadProjects();
|
||||
@@ -446,8 +446,8 @@ function initSchedulePage() {
|
||||
const now = new Date();
|
||||
const firstDay = new Date(now.getFullYear(), now.getMonth(), 1);
|
||||
const lastDay = new Date(now.getFullYear(), now.getMonth() + 1, 0);
|
||||
document.getElementById('filterDateFrom').value = firstDay.toISOString().substring(0, 10);
|
||||
document.getElementById('filterDateTo').value = lastDay.toISOString().substring(0, 10);
|
||||
document.getElementById('filterDateFrom').value = toLocalDate(firstDay);
|
||||
document.getElementById('filterDateTo').value = toLocalDate(lastDay);
|
||||
|
||||
// Setup autocomplete for both modals
|
||||
setupCompanyAutocomplete('addCompanySearch', 'addCompanyDropdown', 'addCompanyId');
|
||||
|
||||
@@ -140,8 +140,8 @@ function initSummaryPage() {
|
||||
// 기본 기간: 이번 달
|
||||
const now = new Date();
|
||||
const firstDay = new Date(now.getFullYear(), now.getMonth(), 1);
|
||||
document.getElementById('filterDateFrom').value = firstDay.toISOString().substring(0, 10);
|
||||
document.getElementById('filterDateTo').value = now.toISOString().substring(0, 10);
|
||||
document.getElementById('filterDateFrom').value = toLocalDate(firstDay);
|
||||
document.getElementById('filterDateTo').value = toLocalDate(now);
|
||||
|
||||
loadCompaniesForFilter();
|
||||
loadSchedulesForFilter();
|
||||
|
||||
@@ -404,8 +404,8 @@ function initWorkReportPage() {
|
||||
// Set default date range to this month
|
||||
const now = new Date();
|
||||
const firstDay = new Date(now.getFullYear(), now.getMonth(), 1);
|
||||
document.getElementById('filterDateFrom').value = firstDay.toISOString().substring(0, 10);
|
||||
document.getElementById('filterDateTo').value = now.toISOString().substring(0, 10);
|
||||
document.getElementById('filterDateFrom').value = toLocalDate(firstDay);
|
||||
document.getElementById('filterDateTo').value = toLocalDate(now);
|
||||
|
||||
loadCompaniesForFilter();
|
||||
loadReports();
|
||||
|
||||
Reference in New Issue
Block a user