diff --git a/front/src/main/resources/templates/record/calendar.html b/front/src/main/resources/templates/record/calendar.html index 3476e604..05376d13 100644 --- a/front/src/main/resources/templates/record/calendar.html +++ b/front/src/main/resources/templates/record/calendar.html @@ -819,15 +819,16 @@ // 오늘 날짜가 해당 달의 마지막 날인지 확인 const today = new Date(); - const lastDayOfMonth = new Date(viewDate.getFullYear(), viewDate.getMonth() + 1, 0); // 해당 달의 마지막 날 - // 쿠키에서 마지막 alert 날짜 확인 - const lastAlertDate = getCookie('lastAlertDate'); - const todayDateString = today.toISOString().split('T')[0]; + //const lastDayOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0); // 해당 달의 마지막 날 + const lastDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 21); // TODO 삭제 테스트를 위해 22일로 수정 + // 마지막 alert 날짜 확인 + const lastAlertDate = sessionStorage.getItem('lastAlertDate'); + const todayDateString = today.toDateString(); + if (lastAlertDate !== todayDateString && today.getFullYear() === lastDayOfMonth.getFullYear() && - today.getMonth() === lastDayOfMonth.getMonth() && + today.getMonth() === lastDayOfMonth.getMonth() && today.getDate() === lastDayOfMonth.getDate()) { - ajaxUtil._ajaxSyncMethod( ENV.httpUrl.alert.replace('{searchMonth}', searchMonth.replace('-', '')), {}, @@ -862,6 +863,7 @@ message: msgTxt, type:'alert', callback: function () { + sessionStorage.setItem('lastAlertDate',lastDayOfMonth.toDateString()); }, }); } @@ -879,20 +881,6 @@ }, }; - // 쿠키 설정 함수 - function setCookie(name, value, days) { - const expires = new Date(); - expires.setTime(expires.getTime() + days * 24 * 60 * 60 * 1000); - document.cookie = `${name}=${value};expires=${expires.toUTCString()};path=/`; - } - - // 쿠키 가져오기 함수 - function getCookie(name) { - const value = `; ${document.cookie}`; - const parts = value.split(`; ${name}=`); - if (parts.length === 2) return parts.pop().split(';').shift(); - return null; - }