오늘의 잔디

<button id="goTodayBtn">📅 오늘로 가기</button>
👆 캘린더 상단 왼쪽 또는 상단 바에 버튼을 배치했음.
document.getElementById('goTodayBtn').addEventListener('click', () => {
if (!calendarInstance) return;
// 현재 월의 1일로 설정 → 달력을 현재 월로 렌더링
calendarInstance.current = moment().date(1);
calendarInstance.draw();
// 오늘 날짜 셀 하이라이트 효과
const todayStr = moment().format("YYYY-MM-DD");
const todayCell = document.querySelector(`[data-date="${todayStr}"]`);
if (todayCell) {
todayCell.classList.add('highlight-today');
setTimeout(() => todayCell.classList.remove('highlight-today'), 2000); // 2초 뒤 제거
}
});
.highlight-today {
outline: 2px solid #00bfff;
border-radius: 50%;
animation: pulse 1s ease-in-out infinite alternate;
}
@keyframes pulse {
from { transform: scale(1); }
to { transform: scale(1.1); }
}
moment()로 손쉽게 처리할 수 있다.data-date 속성을 활용해 오늘 날짜 셀을 정확히 찾아 강조하는 게 핵심!