{"id":2567,"date":"2022-08-30T15:25:56","date_gmt":"2022-08-30T15:25:56","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/02\/03\/problems-with-trent-richardson-timepicker-and-datetimepicker-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:25:56","modified_gmt":"2022-08-30T15:25:56","slug":"problems-with-trent-richardson-timepicker-and-datetimepicker-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/problems-with-trent-richardson-timepicker-and-datetimepicker-collection-of-common-programming-errors\/","title":{"rendered":"Problems with Trent Richardson timepicker and datetimepicker-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m trying to implement Trent&#8217;s timepicker, but I&#8217;m not being able to do it. I&#8217;m testing it in Chrome, Firefox, and IE9.<\/p>\n<p>I already imported Jquery and Jquery UI. The only common error I could find was that Jquery UI wasn&#8217;t the full version(without slides), but that&#8217;s not my case. Anyway, the errors are the following<\/p>\n<pre><code>Cannot set property 'formatTime' of undefined (line ...)\n$.datepicker.formatTime = function(format, time, options) { (this is the line)\n\nCannot call method '_newInst' of undefined\n$t.datepicker($.timepicker._newInst($t, o)._defaults);\n<\/code><\/pre>\n<p>I would thank any help, I&#8217;m really new at jQuery and I don&#8217;t really get it.<\/p>\n<ol>\n<li>\n<p>I had this exact same problem earlier today. I solved it by making sure I had the latest versions of jQuery and jQuery UI (at first I only updated jQuery and the problem persisted). I would also make sure you have the latest version from Trent Richardson.<\/p>\n<\/li>\n<li>\n<p>Download full version of jquery-ui here, but check all boxes including &#8220;Datepicker&#8221;. Then replace your jquery-ui js file and run your project. Worked for me.<\/p>\n<\/li>\n<li>\n<p>Use it with an object as input, meaning the extra curly braces:<\/p>\n<pre><code> \n$('#pickuptime').datetimepicker( { } );\n<\/code><\/pre>\n<p>instead of this:<\/p>\n<pre><code> \n$('#pickuptime').datetimepicker( );\n<\/code><\/pre>\n<\/li>\n<li>\n<p>I had exactly the same problem last night. The cause of the problem turned out that timepicker javascript file was loaded after the jQuery UI javascript. Since timepicker wants to use <strong><code>$.datepicker<\/code> that should have been initialized in jQuery UI<\/strong>, it failed miserably.<\/p>\n<p>In my personal situation, I am using it on Ruby on Rails environment, and I let the order of the javascript loading handled by asset pipeline. It is a nice environment that handles javascript loading with minifying automatically. But I gave that up and went back to linking js files from html manually, and voila! It worked.<\/p>\n<\/li>\n<li>\n<p>Looks like you are having an issue referring to jquery UI with <strong>datepicker<\/strong><\/p>\n<p>from date time picker web site<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/asSxb.png\" \/><\/p>\n<p>try this reference before your date time picker and after jquery reference<\/p>\n<pre><code>\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2014-02-03 02:34:34. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I&#8217;m trying to implement Trent&#8217;s timepicker, but I&#8217;m not being able to do it. I&#8217;m testing it in Chrome, Firefox, and IE9. I already imported Jquery and Jquery UI. The only common error I could find was that Jquery UI wasn&#8217;t the full version(without slides), but that&#8217;s not my case. Anyway, the errors are the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2567","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2567","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2567"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2567\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2567"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2567"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}