My goal is to make a time countdown component. I must show a difference of date from current date to user-entered date, in Year Month Day Hour Min Sec format.
I tried to minus the two dates but ended up with 00:00:00:00. Adding them gave me a result but minus gives me this 00.
Other answers do not satisfy requirements or explain why I get a difference of 0 when subtracting dates.
my code:
import "./App.css";
import Countdown from "react-countdown";
function App() {
  console.log(Date.now());
  return (
    <div className="App">
      <h1>Hello</h1>
      <form>
        <input type="date" />
        <button>submit</button>
      </form>
      <Countdown date={new Date(2021, 6, 10) + Date.now()} />,
    </div>
  );
}
 
     
     
    