7

I need to have my users select a date and time in one of my forms, and I don't want to spend time reinventing the wheel to create a datetime picker in JavaScript. The problem is that the only "pickers" I can find online are all based on jQuery, which normally wouldn't be a problem except that the entire site is practically finished without using jQuery at all. So it would feel stupid to use that entire giant framework now when all I need it for is a single input on one form on one page of my site.

2 Answers 2

4

There is a datetime Picker in HTML5 but it doesn't work for all browsers. You can try this example: https://www.w3schools.com/html/tryit.asp?filename=tryhtml_input_date

6
  • Seems to work on Chrome. But not Firefox, which is probably a pretty big deal. No on IE11 too.. Commented Mar 18, 2014 at 16:19
  • Doesn't work on Safari either... Commented Mar 18, 2014 at 16:21
  • 1
    I don't know his business. I agree if this is a all-public web app, a plugin is required, but this will be the solution in a few years :-)
    – clement
    Commented Mar 18, 2014 at 16:22
  • 8
    Sounds good. I'll upvote this in a few years. Commented Mar 18, 2014 at 16:24
  • that's a date picker, not a date-time picker.
    – user3909192
    Commented Feb 25, 2018 at 22:46
3

We've been using Pikaday with great success on our project. One of our forms has over 60 date fields on it (legal industry), and this little widget has performed very well. It's 5kb minified and highly configurable. The default styling looks pretty slick, too. One last thing I'd like to add is that Pikaday also has the ability to clean up after itself (.destroy command), which has been extremely helpful on more dynamic forms.. Many other date pickers don't clean up after themselves when the node to which they're attached is removed from the dom. Highly recommend it.

Proper Introduction Here.

2
  • That actually looks awesome, but seems to only support dates at the moment instead of date & time. I'd prefer an all-in-one solution, but if I can't find one then I guess I could combine two separate plugins. Commented Mar 18, 2014 at 16:23
  • @AlexRamallo: Hmm..I could've sworn there was a Time component as well..maybe on a fork of pikaday. Possibly here - github.com/dbushell/Pikaday/pull/18 Commented Mar 18, 2014 at 16:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.