fix:차량일지 기간 설정 시간대 문제 수정 (로컬 시간대 사용)

This commit is contained in:
김보곤
2026-02-03 13:16:47 +09:00
parent f996771d5d
commit 4e5f8ba77c

View File

@@ -60,6 +60,14 @@
function VehicleLogsManagement() {
const { vehicles, tripTypes, locationTypes } = window.INITIAL_DATA;
// 날짜를 YYYY-MM-DD 형식으로 포맷 (로컬 시간대 사용)
const formatDate = (date) => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
};
// 이번 달 시작일/종료일 계산
const getMonthRange = (date) => {
const year = date.getFullYear();
@@ -67,8 +75,8 @@ function VehicleLogsManagement() {
const firstDay = new Date(year, month, 1);
const lastDay = new Date(year, month + 1, 0);
return {
start: firstDay.toISOString().split('T')[0],
end: lastDay.toISOString().split('T')[0]
start: formatDate(firstDay),
end: formatDate(lastDay)
};
};
@@ -157,7 +165,7 @@ function VehicleLogsManagement() {
};
const handleAdd = () => {
const today = new Date().toISOString().split('T')[0];
const today = formatDate(new Date());
setModalMode('add');
setEditingItem(null);