简体   繁体   中英

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. does moment.js provide and picking format too or it just give current date and time. If question repeated please mention link

OR is there any other javascript to make a time and date picker

okay I did it all to get time-out functionality in given time and date

this is 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM