Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/pages/TVPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2524,6 +2524,23 @@ const _todayForEpisodes = (() => {
return d;
})();

function getDaysUntilRelease(airDate) {
if (!airDate) return "";

const target = new Date(airDate);
target.setHours(0, 0, 0, 0);

const today = new Date();
today.setHours(0, 0, 0, 0);

const diffMs = target - today;
const days = Math.round(diffMs / (1000 * 60 * 60 * 24));

if (days <= 0) return "Releasing today";
if (days === 1) return "1 day left";
return `${days} days left`;
}

const EpisodeCard = memo(function EpisodeCard({
ep,
itemId,
Expand Down Expand Up @@ -2587,6 +2604,7 @@ const EpisodeCard = memo(function EpisodeCard({
) : epUnreleased ? (
<div className="episode-restricted-overlay">
🔒<span>Unreleased</span>
<span>{getDaysUntilRelease(ep.air_date)}</span>
</div>
) : isPlaying ? (
<div className="episode-playing-badge">
Expand Down
2 changes: 1 addition & 1 deletion src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -2491,7 +2491,7 @@ kbd {
align-items: center;
justify-content: center;
gap: 4px;
font-size: 18px;
font-size: 12px;
border-radius: inherit;
}

Expand Down
Loading