자바스크립트는 이상하게 월이 0부터 시작해서
+1을 해야 한다
`${curDate.getMonth() + 1}월`
~년 ~월은 이렇게
`${curDate.getFullYear()}년 ${curDate.getMonth() + 1}월`
const increaseMonth = () => {
setCurDate(
new Date(curDate.getFullYear(), curDate.getMonth() + 1, curDate.getDate())
);
};
const decreaseMonth = () => {
setCurDate(
new Date(curDate.getFullYear(), curDate.getMonth() - 1, curDate.getDate())
);
};
#100daysofcode day31
'개발일지' 카테고리의 다른 글
TIL 2022.05.19 (0) | 2022.05.19 |
---|---|
TIL 2022.05.18 (0) | 2022.05.18 |
TIL 2022.05.15 (0) | 2022.05.15 |
TIL 2022.05.13 (0) | 2022.05.13 |
TIL 2022.05.12 (0) | 2022.05.12 |