I am new to coding I have confused about the concept of Dates in JavaScript. I need to validate that the user has selected 3 years before's date in the textbox*, but my codes through some errors.* Check The Following Code:
<script>
      function run() {
        var dt =document.getElementById("dt").value; //Value of selected date
        var ndt = new Date(); //Current Date
        var diff = ndt.getTime()-dt.getTime();
        var milliseconds =  1000 * 60 * 60 * 24;
        var result = diff/milliseconds;
        if (result > 1095) {
          alert("Correct");
        } else {
          alert("Wrong")
        };
      }
      </script>