diff --git a/resources/views/barobill/hometax/index.blade.php b/resources/views/barobill/hometax/index.blade.php index bbae6cf8..59edb60e 100644 --- a/resources/views/barobill/hometax/index.blade.php +++ b/resources/views/barobill/hometax/index.blade.php @@ -77,24 +77,28 @@ const CSRF_TOKEN = '{{ csrf_token() }}'; - // 로컬 타임존 기준 날짜 포맷 (YYYY-MM-DD) - 한국 시간 기준 - const formatLocalDate = (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}`; + // 한국 시간대(Asia/Seoul, UTC+9) 기준 날짜 포맷 (YYYY-MM-DD) + const formatKoreanDate = (date) => { + // en-CA 로케일은 YYYY-MM-DD 형식을 반환함 + return date.toLocaleDateString('en-CA', { timeZone: 'Asia/Seoul' }); }; - // 날짜 유틸리티 함수 + // 한국 시간대 기준 현재 날짜 가져오기 + const getKoreanNow = () => { + const koreaDateStr = new Date().toLocaleString('en-US', { timeZone: 'Asia/Seoul' }); + return new Date(koreaDateStr); + }; + + // 날짜 유틸리티 함수 - 한국 시간대(Asia/Seoul) 기준 const getMonthDates = (offset = 0) => { - const now = new Date(); + const now = getKoreanNow(); const year = now.getFullYear(); const month = now.getMonth() + offset; const firstDay = new Date(year, month, 1); const lastDay = new Date(year, month + 1, 0); return { - from: formatLocalDate(firstDay), - to: formatLocalDate(lastDay) + from: formatKoreanDate(firstDay), + to: formatKoreanDate(lastDay) }; };