Merge branch 'khj'

This commit is contained in:
khj0414 2025-04-04 13:22:43 +09:00
commit 87465c01fa

View File

@ -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>