datetimepicker icon indicating copy to clipboard operation
datetimepicker copied to clipboard

jquery.datetimepicker.js:1760 Uncaught TypeError: Cannot read property 'formatDate' of null at jquery.datetimepicker.js:1760

Open ramwin opened this issue 7 years ago • 17 comments
trafficstars

Hello, everyone. I searched the issues and found issue #573, has the solution to solve this. However, after applying the solution, the style of html is totally abnormal. My code is like this:

<!DOCTYPE html>
<html>
  <head>
    <title></title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <link ref="stylesheet" type="text/css" href="source/jquerydatetimepicker/jquery.datetimepicker.css">
  </head>
  <body>
    <input id="datetimepicker" type="text" >
  </body>
  <script src="source/jquery-3.1.0.js"></script>
  <script src="source/moment.js"></script>
  <script src="source/jquerydatetimepicker/jquery.datetimepicker.js"></script>
    <script>
      $.datetimepicker.setDateFormatter({
          parseDate: function (date, format) {
              var d = moment(date, format);
              return d.isValid() ? d.toDate() : false;
          },
          formatDate: function (date, format) {
              return moment(date).format(format);
          },
      });
      $('#datetimepicker').datetimepicker();
    </script>
</html>

Here is the source code. And it looks like this: datetimepickerror

ramwin avatar May 24 '18 03:05 ramwin

the solution on me does worst, the data is all weird, visualization is fine by the way

VaLThieL avatar Jun 08 '18 15:06 VaLThieL

The workaround also does not work properly for me. As with @ramwin's screenshot, the minutes are shown as "i". I think this project is dead. I'm now going to use this one myself.

Bert-de-Jong avatar Aug 31 '18 09:08 Bert-de-Jong

Another good alternative might be this: https://github.com/flatpickr/flatpickr

Bert-de-Jong avatar Aug 31 '18 09:08 Bert-de-Jong

I switched from this project to date range picker, you can set singleDatePicker as true, then it works like a datetimepicker.

ramwin avatar Aug 31 '18 09:08 ramwin

I also met this issue, the solution was to include "jquery.datetimepicker.full.js" instead of "jquery.datetimepicker.js".

monlouisj avatar Jan 15 '19 15:01 monlouisj

@monlouisj nailed it

junaidulqayyumqureshi avatar Mar 14 '19 06:03 junaidulqayyumqureshi

@monlouisj thanks!

Jellyfishboy avatar Apr 12 '19 14:04 Jellyfishboy

@monlouisj thanks...

themehunk avatar May 24 '19 08:05 themehunk

I also met this issue, the solution was to include "jquery.datetimepicker.full.js" instead of "jquery.datetimepicker.js".

I changed my code using jquery.datetimepicker.full.js but the html is still broken. Here is the code.

ramwin avatar May 24 '19 10:05 ramwin

I also met this issue, the solution was to include "jquery.datetimepicker.full.js" instead of "jquery.datetimepicker.js".

This saved me from 4 hours of searching and implemening different things. Cheers

larrytech7 avatar Jun 05 '19 12:06 larrytech7

I also met this issue, the solution was to include "jquery.datetimepicker.full.js" instead of "jquery.datetimepicker.js".

I changed my code using jquery.datetimepicker.full.js but the html is still broken. Here is the code.

You can write $.datetimepicker.setDateFormatter('moment'); instead of $.datetimepicker.setDateFormatter be sure it work!

Alru33 avatar Jul 19 '19 08:07 Alru33

I try to use jquery.datetimepicker.full.min.js and still ok, looks like we all that wrong. we use the file on the main dir instead of on the build directory?

Let's wait the maintainer to confirm this, I did like to suggest to explicitly note this on the documentation, so the future user won't end up on this kind of errors.

sukrosono avatar Sep 01 '19 15:09 sukrosono

@Alru33 thank you.. I spent too long looking at the source code and your line solved my problem.

Anbranin avatar Oct 08 '19 14:10 Anbranin

I also met this issue, the solution was to include "jquery.datetimepicker.full.js" instead of "jquery.datetimepicker.js".

my man

flopana avatar Mar 23 '20 10:03 flopana

I just got this problem. And i solved it by following these steps on this page - the demo section. https://www.jqueryscript.net/time-clock/Clean-jQuery-Date-Time-Picker-Plugin-datetimepicker.html it work for me 🗡️

BruceGoodGuy avatar May 29 '20 07:05 BruceGoodGuy

I also met this issue, the solution was to include "jquery.datetimepicker.full.js" instead of "jquery.datetimepicker.js".

my man

This is the solution. jut in case

ermya avatar Aug 29 '22 04:08 ermya

I also met this issue, the solution was to include "jquery.datetimepicker.full.js" instead of "jquery.datetimepicker.js".

Thank you so much, you are a life saver

HadiNiazi avatar Sep 25 '22 05:09 HadiNiazi