Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript Datetime picker without jQuery? [closed]

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.

like image 448
AlexRamallo Avatar asked Mar 18 '14 16:03

AlexRamallo


People also ask

How do you close a date picker?

In this article, we will use the jQuery UI Datepicker hide() method to close the previously opened date picker widget. This method does not accept any parameter.

What is Lightpick?

Installation. Usage. Examples. Configuration.

How do you style a datepicker?

Right click on datepicker box. Select 'inspect' (Ctrl+Shift+I) in Chrome or 'inspect element' (Q) in Firefox. Find the CSS style that you want to change.

Is there a date picker without a DateTimePicker?

Vanilla JavaScript Calendar Date Picker This is an unblemished looking CSS datepicker example without datetimepicker plan using Vanilla Javascript/JS. The developer has used little enthusiasm effects to show which date you will pick. Float impacts are smooth and don’t take a great deal of your time.

What is flatpickr – JavaScript datetime picker?

Flatpickr – javascript datetime picker is a simple yet powerful and customizable js library that enables the visitor to choose a date/time/date range from a flat, and clean calendar. Almost every resort or large project includes a date and time input. Native browser implementations of these are inconsistent and limited in functionality.

How to create a datepicker that closes on select in JavaScript?

First, click the button to open the datepicker and then select a date: Steps for creating datepicker that closes on select: First of all, create a new Datepickk object: After that, call the function closeOnSelectDemo at the click event of button: And this is the JS function:

How to close the calendar after selecting a date in JavaScript?

And this is the JS function: Rather than closing the date picker after just selecting a date, you may enable the users to first select a date and then click on “Close” button in the calendar to close the calendar. See the following demonstration with code:


2 Answers

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

like image 90
clement Avatar answered Oct 23 '22 07:10

clement


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.

like image 39
Daniel Szabo Avatar answered Oct 23 '22 05:10

Daniel Szabo