    <!DOCTYPE html>
    <html>
    <head>
      <meta charset="UTF-8">
      <title>날짜 계산기</title>
      <link rel="stylesheet" href="style_js.css">
    <body>
      <h2>궁금한 날짜를 입력하세요:</h2>
      <input type="number" id="year" placeholder="년">
      <input type="number" id="month" placeholder="월">
      <input type="number" id="day" placeholder="일">
      <button onclick="calculateDays()">계산</button><hr>
      <p id="today"></p>
      <p id="result"></p>
      <script>
        function calculateDays() {
          const year = parseInt(document.getElementById("year").value);
          const month = parseInt(document.getElementById("month").value);
          const day = parseInt(document.getElementById("day").value);

          const today = new Date();
          const inputDate = new Date(year, month - 1, day);
          const timeDiff = today - inputDate;
          const daysDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24));

          document.getElementById("today").innerHTML=`${today.toLocaleString()}`;
          if(daysDiff >= 0)
            document.getElementById("result").innerHTML=`${daysDiff}일 전`;
          else
            document.getElementById("result").innerHTML=`${-(daysDiff)}일 남았음`;
        }
      </script>
    </body>
    </html>