title: How to use input from user to countdown?
body: <p>I'm making a countdown and I want that the user can say to which date the countdown should go.
  I already created an input from the user and I guess I should change the const difference to use the date from the input but I don't know how I could do that.</p>
  <pre><code>import React, {useEffect, useState} from &quot;react&quot;;
  import './styles.css';
  
  function OwnInput() {
      const calculateTimeLeft = () =&gt; {
          let year = new Date().getFullYear();
      
          const difference = +new Date(`01/01/${year+1}`) - +new Date();
          
          let timeLeft = {};
      
          if (difference &gt; 0) {
            timeLeft = {
              days: Math.floor(difference / (1000 * 60 * 60 * 24)),
              hours: Math.floor((difference / (1000 * 60 * 60)) % 24), 
              minutes: Math.floor((difference / 1000 / 60) % 60),
              seconds: Math.floor((difference / 1000) % 60)
            };
          }
      
          return timeLeft
        };
          
          const [timeLeft, setTimeLeft] = useState(calculateTimeLeft());
          const [year] = useState(new Date().getFullYear());
      
          useEffect(() =&gt; {
            const timer = setTimeout(() =&gt; {
              setTimeLeft(calculateTimeLeft());
            }, 1000);
            return () =&gt; clearTimeout(timer);
          });
          const timerComponents = [];
      
        Object.keys(timeLeft).forEach((interval) =&gt; {
          if (!timeLeft[interval]) {
            return;
        }
      
        timerComponents.push(
          &lt;span&gt;
            {timeLeft[interval]} {interval}{&quot; &quot;}
          &lt;/span&gt;
        );
        });
        return (
          &lt;div className=&quot;nieuwjaar&quot;&gt;
            &lt;h1&gt;Own Date&lt;/h1&gt;
            &lt;input type=&quot;date&quot; &gt;&lt;/input&gt;
            &lt;br&gt;&lt;/br&gt;
            {timerComponents.length ? timerComponents : &lt;span&gt;Time's Up!&lt;/span&gt;}
          &lt;/div&gt;
        );
  }
  
  export default OwnInput;
  </code></pre>