moment-countdown js 库给我一个奇怪的变量赋值?

moment-countdown js library giving me a weird variable assignment?

我正在使用的库:https://github.com/icambron/moment-countdown

我的代码:

<!DOCTYPE html>
<html>

<head>
  <title>Test</title>
  <!-- https://github.com/icambron/moment-countdown -->
  <script src="moment.min.js"></script>
  <script src="countdown.min.js"></script>
  <script src="moment-countdown.min.js"></script>
</head>

<body>
  <input type="datetime-local" id="timeInputHTML" onchange="mainfunc()>
  <p id="pel"></p>
  <script>
    function mainfunc() {
      timeVar = document.getElementById("timeInputHTML").value;
      // var timeInputVar = moment("2045-01-01 00:00:00").countdown().toString(); 
      var timeInputVar = moment(timeVar).countdown().toString();
      document.getElementById("pel").innerHTML = timeInputVar;
    }

    // Run above function every 1 second
    setInterval(mainfunc, 1000);
  </script>
</body>

</html>

问题:当变量 timeVar 从 HTML 代码中的 timeInputHTML 获取值时,如何使变量 timeVar 不包含中间包含一个 T,如下所示: "2018-05-05T14:30" 我相信这就是我的代码有问题并导致了 Uncaught TypeError 如果这不是问题那么请你能向我解释一下是什么吗?

图片/截图:

<!DOCTYPE html>
<html>

<head>
  <title>Test</title>
  <!-- https://github.com/icambron/moment-countdown -->
  <script src="moment.min.js"></script>
  <script src="countdown.min.js"></script>
  <script src="moment-countdown.min.js"></script>
</head>

<body>
  <input type="datetime-local" id="timeInputHTML" onchange="mainfunc()">
  <p id="pel"></p>
  <script>
    function mainfunc() {
      timeVar = document.getElementById("timeInputHTML").value;
      // var timeInputVar = moment("2045-01-01 00:00:00").countdown().toString(); 
      var timeInputVar = moment(timeVar).countdown().toString();
      document.getElementById("pel").innerHTML = timeInputVar;
    }

    // Run above function every 1 second
    setInterval(mainfunc, 1000);
  </script>
</body>

</html>

你缺少输入函数中的这个应该是这样的

<input type="datetime-local" id="timeInputHTML" onchange="mainfunc()">