簡體   English   中英

使用moment.js作為日歷中的日期和時間選擇器

[英]Use moment.js as date and time picker from calendar

我喜歡將javascript和html用於將來或過去的客戶端日期選擇。 moment.js是否moment.js提供並選擇格式,或者僅提供當前日期和時間。 如果問題重復,請提及鏈接

或是否有其他JavaScript可以制作時間和日期選擇器

好吧,我做到了所有這些以在給定的時間和日期中獲得超時功能

這是app.js

  app.post('/aa', function (req, res, next) {   
  var first = req.body.firstd
  var second = req.body.secondd
  var firstt = moment(first)
  var secondds = moment(second)
  console.log(firstt)
  console.log(secondds)
  var timeoutto = secondds.diff(first)
  console.log(secondds.diff(first))

  setTimeout(function () {
    res.send('Hello world')
  }, timeoutto)
})

這是html

<form action="/aa" method="POST">
        <input type="datetime-local" name="firstd">
        <input type="datetime-local" name="secondd">
        <input type="submit" value="Send">
</form>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM