코드수정정
This commit is contained in:
parent
f37c8ec947
commit
5b24a0254b
@ -32,12 +32,10 @@
|
||||
@error="setDefaultImage"
|
||||
/>
|
||||
</div>
|
||||
<!-- <div class="timeline-event ps-1" style="cursor: pointer;" @click="goVoteList()" > -->
|
||||
<div class="timeline-event ps-1" style="cursor: pointer;" @click.stop="openModal(item.localVote.LOCVOTSEQ)" >
|
||||
<div class="timeline-header ">
|
||||
<small ><strong>{{ truncateTitle(item.localVote.LOCVOTTTL) }}</strong></small>
|
||||
</div>
|
||||
|
||||
<small class="d-flex align-items-center lh-1 me-4 mb-4 mb-sm-0"
|
||||
:style="{ color: getDaysAgo(item.localVote.formatted_LOCVOTEDT) == '금일 종료' ? 'red' : '' }">
|
||||
⏰{{getDaysAgo(item.localVote.formatted_LOCVOTEDT)}}({{item.localVote.total_voted}}/{{ item.localVote.total_votable }})
|
||||
@ -53,7 +51,6 @@
|
||||
<div class="card-body" v-else>
|
||||
진행중인 투표가 없습니다.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!--투표 모달 -->
|
||||
@ -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)}일 전`;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user