Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: CHAT-325-useCalendar-리팩토링 #98

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Nangniya
Copy link
Collaborator

@Nangniya Nangniya commented Apr 5, 2024

요약 (Summary)

useCalendar 리팩토링

변경 사항 (Changes)

  • 캘린더 데이터 조회할때 쓰는 날짜 형식 포맷 함수 분리
  • 불필요한 useMemo 제거
  • useEffect 의존 배열 최적화

리뷰 요구사항

확인 방법 (선택)

Comment on lines +43 to +57
//YYYY-MM 형태
export const formatRequestCalendarDate = (year: number, month: number) => {
return `${year}-${month + 1 < 10 ? '0' + (month + 1) : month + 1}`;
};

//YYYY-MM-DD 형태
export const formatCalendarListDay = (
year: number,
month: number,
day: number,
) => {
return `${year}-${month + 1 < 10 ? '0' + (month + 1) : month + 1}-${
day < 10 ? '0' + day : day
}`;
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//YYYY-MM 형태
export const formatRequestCalendarDate = (year: number, month: number) => {
return `${year}-${month + 1 < 10 ? '0' + (month + 1) : month + 1}`;
};
//YYYY-MM-DD 형태
export const formatCalendarListDay = (
year: number,
month: number,
day: number,
) => {
return `${year}-${month + 1 < 10 ? '0' + (month + 1) : month + 1}-${
day < 10 ? '0' + day : day
}`;
};
export const formatCalendarDate = (year: number, month: number, day?: number) => {
const formattedMonth = month + 1 < 10 ? '0' + (month + 1) : month + 1;
return day ? `${year}-${formattedMonth}-${day < 10 ? '0' + day : day}` : `${year}-${formattedMonth}`;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants