fix: 모든 시간 처리를 한국 시간(KST) 기준으로 변경
🇰🇷 Korean Standard Time (KST) Implementation: - UTC+9 시간대로 모든 시간 처리 통일 - 서버와 클라이언트 간 시간 기준 일치 🕐 KST Utility Functions: - getKSTDate(): UTC → KST 변환 함수 - formatKSTDate(): KST 기준 날짜 포맷팅 (2024. 10. 25.) - formatKSTTime(): KST 기준 시간 포맷팅 (14:30) - getKSTToday(): KST 기준 오늘 날짜 반환 ⏰ Time Display Improvements: - 업로드 시간: KST 기준 날짜 + 시간 표시 - 상대 시간: '2시간 전' 등도 KST 기준으로 계산 - getTimeAgo(): KST 기준 시간 차이 계산 📊 Statistics Calculation (KST-based): - 금일 신규: KST 기준 오늘 00:00 이후 등록 - 미해결: KST 기준 오늘 이전 등록된 건 - 통계 로그에 KST 기준 날짜 정보 포함 🔧 Technical Implementation: - timeZone: 'Asia/Seoul' 명시적 설정 - UTC + 9시간 오프셋 계산 - 모든 날짜 비교를 KST 기준으로 통일 🌏 Timezone Consistency: - 서버 KST ↔ 클라이언트 KST 일치 - 사용자 위치와 관계없이 한국 시간 기준 - 통계 및 필터링 정확성 향상 Expected Result: ✅ 모든 시간이 한국 시간(KST) 기준으로 표시 ✅ 오늘/어제 구분이 한국 시간 기준으로 정확히 작동 ✅ 서버와 클라이언트 시간 기준 일치 ✅ 사용자 위치와 무관한 일관된 시간 표시
This commit is contained in:
@@ -386,6 +386,33 @@
|
||||
let issues = [];
|
||||
let projects = [];
|
||||
let filteredIssues = [];
|
||||
|
||||
// 한국 시간(KST) 유틸리티 함수
|
||||
function getKSTDate(date) {
|
||||
const utcDate = new Date(date);
|
||||
// UTC + 9시간 = KST
|
||||
return new Date(utcDate.getTime() + (9 * 60 * 60 * 1000));
|
||||
}
|
||||
|
||||
function formatKSTDate(date) {
|
||||
const kstDate = getKSTDate(date);
|
||||
return kstDate.toLocaleDateString('ko-KR', { timeZone: 'Asia/Seoul' });
|
||||
}
|
||||
|
||||
function formatKSTTime(date) {
|
||||
const kstDate = getKSTDate(date);
|
||||
return kstDate.toLocaleTimeString('ko-KR', {
|
||||
timeZone: 'Asia/Seoul',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
});
|
||||
}
|
||||
|
||||
function getKSTToday() {
|
||||
const now = new Date();
|
||||
const kstNow = getKSTDate(now);
|
||||
return new Date(kstNow.getFullYear(), kstNow.getMonth(), kstNow.getDate());
|
||||
}
|
||||
|
||||
// 애니메이션 함수들
|
||||
function animateHeaderAppearance() {
|
||||
@@ -639,8 +666,8 @@
|
||||
container.innerHTML = filteredIssues.map(issue => {
|
||||
const project = projects.find(p => p.id === issue.project_id);
|
||||
const reportDate = new Date(issue.report_date);
|
||||
const createdDate = reportDate.toLocaleDateString('ko-KR');
|
||||
const createdTime = reportDate.toLocaleTimeString('ko-KR', { hour: '2-digit', minute: '2-digit' });
|
||||
const createdDate = formatKSTDate(reportDate);
|
||||
const createdTime = formatKSTTime(reportDate);
|
||||
const timeAgo = getTimeAgo(reportDate);
|
||||
|
||||
// 사진 정보 처리
|
||||
@@ -728,17 +755,18 @@
|
||||
// 통계 로드 (새로운 기준)
|
||||
async function loadStatistics() {
|
||||
try {
|
||||
// 현재 수신함 이슈들을 기반으로 통계 계산
|
||||
const today = new Date();
|
||||
const todayStart = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
||||
// 현재 수신함 이슈들을 기반으로 통계 계산 (KST 기준)
|
||||
const todayStart = getKSTToday();
|
||||
console.log('📅 KST 기준 오늘 시작:', todayStart);
|
||||
|
||||
// 전체: 수신함에 남아있는 목록 개수 (pending_review 상태)
|
||||
const totalCount = issues.length;
|
||||
|
||||
// 금일 신규: 오늘 올라온 목록 숫자 (확인된 것 포함)
|
||||
// 금일 신규: 오늘 올라온 목록 숫자 (확인된 것 포함) - KST 기준
|
||||
const todayNewCount = issues.filter(issue => {
|
||||
const reportDate = new Date(issue.report_date);
|
||||
return reportDate >= todayStart;
|
||||
const reportDate = getKSTDate(new Date(issue.report_date));
|
||||
const reportDateOnly = new Date(reportDate.getFullYear(), reportDate.getMonth(), reportDate.getDate());
|
||||
return reportDateOnly >= todayStart;
|
||||
}).length;
|
||||
|
||||
// 금일 처리: 오늘 처리된 건수 (API에서 가져와야 함)
|
||||
@@ -758,10 +786,11 @@
|
||||
console.log('처리된 건수 조회 실패:', e);
|
||||
}
|
||||
|
||||
// 미해결: 오늘꺼 제외한 남아있는 것들
|
||||
// 미해결: 오늘꺼 제외한 남아있는 것들 - KST 기준
|
||||
const unresolvedCount = issues.filter(issue => {
|
||||
const reportDate = new Date(issue.report_date);
|
||||
return reportDate < todayStart;
|
||||
const reportDate = getKSTDate(new Date(issue.report_date));
|
||||
const reportDateOnly = new Date(reportDate.getFullYear(), reportDate.getMonth(), reportDate.getDate());
|
||||
return reportDateOnly < todayStart;
|
||||
}).length;
|
||||
|
||||
// 통계 업데이트
|
||||
@@ -770,11 +799,12 @@
|
||||
document.getElementById('todayProcessedCount').textContent = todayProcessedCount;
|
||||
document.getElementById('unresolvedCount').textContent = unresolvedCount;
|
||||
|
||||
console.log('📊 통계 업데이트:', {
|
||||
console.log('📊 통계 업데이트 (KST 기준):', {
|
||||
전체: totalCount,
|
||||
금일신규: todayNewCount,
|
||||
금일처리: todayProcessedCount,
|
||||
미해결: unresolvedCount
|
||||
미해결: unresolvedCount,
|
||||
기준일: formatKSTDate(new Date())
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
@@ -1062,8 +1092,9 @@
|
||||
}
|
||||
|
||||
function getTimeAgo(date) {
|
||||
const now = new Date();
|
||||
const diffMs = now - date;
|
||||
const now = getKSTDate(new Date());
|
||||
const kstDate = getKSTDate(date);
|
||||
const diffMs = now - kstDate;
|
||||
const diffMins = Math.floor(diffMs / 60000);
|
||||
const diffHours = Math.floor(diffMs / 3600000);
|
||||
const diffDays = Math.floor(diffMs / 86400000);
|
||||
@@ -1072,7 +1103,7 @@
|
||||
if (diffMins < 60) return `${diffMins}분 전`;
|
||||
if (diffHours < 24) return `${diffHours}시간 전`;
|
||||
if (diffDays < 7) return `${diffDays}일 전`;
|
||||
return date.toLocaleDateString('ko-KR');
|
||||
return formatKSTDate(date);
|
||||
}
|
||||
|
||||
function showLoading(show) {
|
||||
|
||||
Reference in New Issue
Block a user