function formatUpdatedLabel(pricesUpdatedAt) { if (!pricesUpdatedAt) return 'Price date unknown'; const date = new Date(pricesUpdatedAt); if (Number.isNaN(date.getTime())) return 'Price date unknown'; return `Updated ${date.toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric', })}`; } export function stalenessBadgeText({ stale, pricesUpdatedAt }) { if (stale) return 'Prices may be outdated'; return formatUpdatedLabel(pricesUpdatedAt); } import CardDetailLocalStores from './CardDetailLocalStores'; export default function CardDetailPurchaseTab({ card, pricing, pricingLoading, formatCurrency, nearbyStores = [], nearbyStoresLoading = false, nearbyStoresError = null, nearbyStoresNoHomeZip = false, }) { const displayPrice = pricing?.prices?.current ?? pricing?.prices?.market ?? card?.current_price ?? null; const foilPrice = pricing?.prices?.market ?? card?.market_price ?? null; const badgeText = pricing ? stalenessBadgeText(pricing) : null; return (
Loading prices…
) : (NM / Non-foil
{formatCurrency(displayPrice || 0)}
Foil / Market
{formatCurrency(foilPrice)}
View on TCGPlayer
View on eBay