Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trent Richardson's Datetimepicker not showing Time Picker

Trent Richardson's Datetimepicker is not showing the time picker (only jQuery's date picker). Tested it 2 months ago and it is working properly. Just upgraded the JS last month.

  1. This is the current js imports:

    • jquery-1.8.2.min.js
    • jquery-ui-1.8.24.custom.min.js
    • jquery.ui.slideraccess.js (version 0.2.1)
    • jquery-ui-timepicker-addon.js (version 1.0.0)
  2. already tried .removeClass('hasDatepicker'); since it is appending to the class after initialization of datetimepicker

  3. the line $('#dateId').datetimepicker({ is causing a Uncaught TypeError: Cannot call method 'dateId' of null, have to use jQuery instead of $

  4. already tried reverting to jquery-1.7 and updating Trent's scripts to a later version but still experiencing the same problem.

like image 909
sophie Avatar asked Nov 13 '22 16:11

sophie


1 Answers

I'm glad that @Sophie asked and answered this question because I had the same problem and hadn't been able to figure it out until seeing this post.

Apparently, my site loaded jquery-ui-1.8.18.custom.min.js and then loaded another javascript file (e.g. my-site.min.js), which was a server-generated collection of smaller javascript files, all minified.

This bundle js file (e.g. my-site.min.js) contained jquery-ui-1.8.18.custom.min.js too, so jquery-ui was getting loaded twice, which apparently caused the datetimepicker to NOT show the time fields.

I simply removed the line for jquery-ui-1.8.18.custom.min.js (so that my site was now serving it up only once), and now datetimepicker works again.

like image 111
Ryan Avatar answered Nov 15 '22 06:11

Ryan