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 (

Where to Buy

{badgeText && ( {badgeText} )}

Online Price Estimate

{pricingLoading ? (

Loading prices…

) : (

NM / Non-foil

{formatCurrency(displayPrice || 0)}

{foilPrice != null && foilPrice !== displayPrice && (

Foil / Market

{formatCurrency(foilPrice)}

)}
)}
{pricing?.outbound?.tcgplayer && (

TCGPlayer

View on TCGPlayer

)} {pricing?.outbound?.ebay && (

eBay

View on eBay

)}
); }