wow
Some checks failed
/ print-content (push) Has been cancelled

This commit is contained in:
암냥 2026-05-31 13:55:12 +09:00
commit 58ce75b38a
No known key found for this signature in database
114 changed files with 966 additions and 17255 deletions

27
src/components/DDay.astro Normal file
View file

@ -0,0 +1,27 @@
---
export interface Props {
targetDate: string;
label: string;
}
const { targetDate, label } = Astro.props;
---
<div class="flex flex-col items-end text-right text-sm">
<span id="dday-label">D-Day</span>
<span class="text-muted-foreground">{label} | {new Date(targetDate).toDateString()}</span>
</div>
<script define:vars={{ targetDate }}>
const today = new Date();
const target = new Date(targetDate);
const diffTime = target.getTime() - today.getTime();
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
let label = "D-Day";
if (diffDays > 0) label = `D-${diffDays}`;
else if (diffDays < 0) label = `D+${Math.abs(diffDays)}`;
const el = document.getElementById('dday-label');
if (el) el.textContent = label;
</script>