import React, { useState, useEffect } from 'react'; const BoffoCountdown = () => { const [timeLeft, setTimeLeft] = useState(''); const [progress, setProgress] = useState(0); useEffect(() => { const timer = setInterval(() => { const now = new Date(); const nextSunday = new Date(now); nextSunday.setDate(now.getDate() + (7 - now.getDay()) % 7); nextSunday.setHours(11, 30, 0, 0); if (now > nextSunday) { nextSunday.setDate(nextSunday.getDate() + 7); } const difference = nextSunday - now; const totalSeconds = 7 * 24 * 60 * 60; const secondsPassed = totalSeconds - Math.floor(difference / 1000); const progressPercentage = (secondsPassed / totalSeconds) * 100; const days = Math.floor(difference / (1000 * 60 * 60 * 24)); const hours = Math.floor((difference / (1000 * 60 * 60)) % 24); const minutes = Math.floor((difference / 1000 / 60) % 60); const seconds = Math.floor((difference / 1000) % 60); setTimeLeft(`${days}d ${hours}h ${minutes}m ${seconds}s`); setProgress(progressPercentage); }, 1000); return () => clearInterval(timer); }, []); return (
Give me breakfast sandwich or give me death

Countdown to Boffo Sandwich Day

Next sandwich day: Sunday at 11:30 AM PST

{timeLeft}

Boffo's rustic yet elegant sandwich cart at Fort Mason, SF

); }; export default BoffoCountdown;