Refactor useTransactions hook

Splits the useTransactions hook into smaller, more manageable files for improved code organization and maintainability. The original functionality of the hook remains unchanged.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-16 09:03:38 +00:00
parent da9120ba61
commit 468bb79c9e
8 changed files with 485 additions and 303 deletions

View File

@@ -0,0 +1,23 @@
// 월 이름 상수와 날짜 관련 유틸리티 함수
// 월 이름 상수
export const MONTHS_KR = ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월'];
// 현재 월 가져오기
export const getCurrentMonth = () => {
const today = new Date();
return MONTHS_KR[today.getMonth()];
};
// 이전 월 가져오기
export const getPrevMonth = (currentMonth: string) => {
const index = MONTHS_KR.indexOf(currentMonth);
return index > 0 ? MONTHS_KR[index - 1] : MONTHS_KR[11];
};
// 다음 월 가져오기
export const getNextMonth = (currentMonth: string) => {
const index = MONTHS_KR.indexOf(currentMonth);
return index < 11 ? MONTHS_KR[index + 1] : MONTHS_KR[0];
};