简体   繁体   English

使用moment.js作为日历中的日期和时间选择器

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

I like to use javascript and html for client side date picking of future or past. 我喜欢将javascript和html用于将来或过去的客户端日期选择。 does moment.js provide and picking format too or it just give current date and time. moment.js是否moment.js提供并选择格式,或者仅提供当前日期和时间。 If question repeated please mention link 如果问题重复,请提及链接

OR is there any other javascript to make a time and date picker 或是否有其他JavaScript可以制作时间和日期选择器

okay I did it all to get time-out functionality in given time and date 好吧,我做到了所有这些以在给定的时间和日期中获得超时功能

this is app.js 这是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)
})

here is html 这是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