투표 수정정
This commit is contained in:
parent
a97d3b4609
commit
a0c2aa04ad
@ -28,8 +28,11 @@
|
|||||||
<div class="timeline-header ">
|
<div class="timeline-header ">
|
||||||
<small ><strong>{{ truncateTitle(item.localVote.LOCVOTTTL) }}</strong></small>
|
<small ><strong>{{ truncateTitle(item.localVote.LOCVOTTTL) }}</strong></small>
|
||||||
</div>
|
</div>
|
||||||
<small class="d-flex align-items-center lh-1 me-4 mb-4 mb-sm-0"><span >
|
|
||||||
</span>{{getDaysAgo(item.localVote.formatted_LOCVOTEDT)}}({{item.localVote.total_voted}}/{{ item.localVote.total_votable }})</small>
|
<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 }})
|
||||||
|
</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -222,14 +225,15 @@ const getDaysAgo = (dateString) => {
|
|||||||
const inputDate = new Date(dateString); // 문자열을 Date 객체로 변환
|
const inputDate = new Date(dateString); // 문자열을 Date 객체로 변환
|
||||||
const today = new Date(); // 현재 날짜 가져오기
|
const today = new Date(); // 현재 날짜 가져오기
|
||||||
|
|
||||||
// 날짜 차이 계산 (밀리초 기준)
|
const input = new Date(inputDate.getFullYear(), inputDate.getMonth(), inputDate.getDate());
|
||||||
const timeDiff = today - inputDate;
|
const now = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
||||||
const dayDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24))+1; // 일 단위 변환
|
|
||||||
|
|
||||||
|
const timeDiff = now - input;
|
||||||
|
const dayDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
|
||||||
// 오늘 날짜인 경우 "오늘" 반환
|
// 오늘 날짜인 경우 "오늘" 반환
|
||||||
if (dayDiff === 0) return "⏰금일 종료";
|
if (dayDiff === 0) return "금일 종료";
|
||||||
|
|
||||||
return `⏰종료 ${Math.abs(dayDiff)}일 전`;
|
return `종료 ${Math.abs(dayDiff)}일 전`;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user