fix:홈택스 매입/매출 기간 설정 Asia/Seoul 시간대 적용
- formatLocalDate → formatKoreanDate: Asia/Seoul 시간대 기준 날짜 포맷 - getKoreanNow 함수 추가: 한국 시간대 기준 현재 날짜 반환 - getMonthDates: 한국 시간대 기준으로 월의 시작/종료일 계산 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user