개발일지

TIL 2022.05.16

e_e 2022. 5. 16. 19:10

자바스크립트는 이상하게 월이 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