diff --git a/src/components/main/MainVote.vue b/src/components/main/MainVote.vue index ed973f1..3e3161c 100644 --- a/src/components/main/MainVote.vue +++ b/src/components/main/MainVote.vue @@ -32,12 +32,10 @@ @error="setDefaultImage" /> -
{{ truncateTitle(item.localVote.LOCVOTTTL) }}
- ⏰{{getDaysAgo(item.localVote.formatted_LOCVOTEDT)}}({{item.localVote.total_voted}}/{{ item.localVote.total_votable }}) @@ -53,7 +51,6 @@
진행중인 투표가 없습니다.
-
@@ -211,7 +208,7 @@ const voteDelete =(id) =>{ } // 제목이 14글자 넘어가면 ... 처리하는 함수 const truncateTitle = title => { -return title.length > 10 ? title.slice(0, 10) + '...' : title; + return title.length > 10 ? title.slice(0, 10) + '...' : title; }; //투표이동 @@ -229,13 +226,11 @@ const goVoteList = () =>{ const getDaysAgo = (dateString) => { const inputDate = new Date(dateString); // 문자열을 Date 객체로 변환 const today = new Date(); // 현재 날짜 가져오기 - const input = new Date(inputDate.getFullYear(), inputDate.getMonth(), inputDate.getDate()); const now = new Date(today.getFullYear(), today.getMonth(), today.getDate()); - const timeDiff = now - input; const dayDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24)); - // 오늘 날짜인 경우 "오늘" 반환 + // 오늘 날짜인 경우 if (dayDiff === 0) return "금일 종료"; return `종료 ${Math.abs(dayDiff)}일 전`;