JSFiddle - React, Tailwind, and code Playground

HTML

<input id="date" onchange="onDateChange()">

JavaScript

var onDateChange = () => {
  const userInputDate = new Date(document.getElementById("date").value);
  const nowDate = Date.now();  
  const secDiff = (nowDate - userInputDate) / 1000;
  console.log(secDiff);
}