Bootstrap 3 Datepicker (eonasdan) does not work with jQuery 3.0 or above

if you are developing MVC, and you might have chance to look for a DateTimePicker for your MVC project. One of the favorites DateTimePicker is “Bootstrap 3 DatePicker” developed by Eonasdan ( ). You may download and get it from Nuget. You may also install by using Bower, Rails, Angular, Meteor or manually. The latest version in Nuget is v4.15.35.1.


One of the dependency is the jQuery. I have installed the latest one jQuery v3.1.1 at the moment I am writing to this blog.

I have followed the sample code Eonasdan has provided but I could not make it working. After some searching, I found out that Eonasdan has developed it when jQuery was still in v2. And jQuery has some changes from v2 to v3. One of the changes is jQuery does not provide the object.count() for jQuery object. It is changed into object.length

So, now you could make some code changes to the bootstrap-datetimepicker.js and the DatePicker will be working again. There are 2 locations of code that you have to change. Just simply search for “count()” and replace it as “length”.

Hope that my blog will help you to fix it. And as I know, someone has also point this out to the GitHub and commit into a new branch. But Eonasdan has not yet merge it into the release branch. Let’s do this fix in our way before he release the fixed code so that we could get a corrected js from Nuget.


Leave a Reply

Your email address will not be published. Required fields are marked *