Uncaught TypeError: $(...).datetimepicker is not a function

Created on 8 January 2023, over 1 year ago
Updated 15 May 2024, about 1 month ago

Problem

jquery.datetimepicker.js & jquery.datetimepicker.css not found

Steps to reproduce

Install single_datetime module and datetimepicker library using composer
Check browser console, you will see : Uncaught TypeError: $(...).datetimepicker is not a function
and 404 for both files

Proposed resolution

Date picker library folder name is : datetimepicker
but single_datetime.libraries.yml file has the wrong folder file path : /libraries/jquery-datetimepicker/build/jquery.datetimepicker.full.js: {}

๐Ÿ“Œ Task
Status

Closed: duplicate

Version

2.0

Component

Documentation

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia balbeeryadav Mumbai

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡ณ๐Ÿ‡ฑNetherlands idebr

    Can you show how you included the datetimepicker library in your composer.json file? I expect it is missing the following lines from composer.libraries.json:

            "extra": {
              "installer-name": "jquery-datetimepicker"
            },
    
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom drs2034

    I was getting similar issue. This fixed the issue for me.

        "extra": {
            "drupal-libraries-dependencies": true,
            "installer-name": "jquery-datetimepicker",
            "drupal-libraries": {
                "datetimepicker": "https://github.com/xdan/datetimepicker/archive/2.5.20.zip"
            },
    }
  • ๐Ÿ‡ช๐Ÿ‡ธSpain jaims-dev

    I am having this issue too.

    While I think that the best approach would be to work on the composer.json file, I am not really knowledgeable on that.
    Also, I am not sure that the fix would be into place until a patch (to the composer.json file) makes into mainstream. I could be wrong on that (?).
    In the meantime there is a patch that solves the issue in my environment.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium EricVL

    By the way:
    This modification was allready done in the last push before the release of 1.8.
    It should just be cherry-picked to the 2.0 branch.
    My 2 cents

  • ๐Ÿ‡ท๐Ÿ‡บRussia k.prozorov

    I think you just need to fix the module description where it says how to add the library in the extra block, as shown below:

    "drupal-libraries": {
      "jquery-datetimepicker": "https://github.com/xdan/datetimepicker/archive/2.5.20.zip"
    },
    

    In this case, the library will be downloaded to the correct directory.

  • Status changed to Needs work 9 months ago
  • ๐Ÿ‡ท๐Ÿ‡บRussia k.prozorov
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Gautam_105@

    Gautam_105@ โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Gautam_105@

    @balbeeryadav,
    i have try to reproduce this error but not getting any issue in console . if you have any other reproduce step then provide me . and see screenshot as well.

  • Status changed to Needs review 8 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia MukhtarM

    I think it makes use of the drupal-libraries-installer package as specified in the project page.

    After adding:

     "extra": {
        "drupal-libraries": {
            "datetimepicker": "https://github.com/xdan/datetimepicker/archive/2.5.20.zip"
         },
    }

    in the project's main composer.json file (Not the module's json),
    then do:
    composer require zodiacmedia/drupal-libraries-installer (That will download the library) it will work. Reviewed and Thanks.

    @Gautam_105@ please check whether you geting the calendar at the datetime field too.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia MukhtarM

    Attaching ss

  • Status changed to Fixed about 1 month ago
  • ๐Ÿ‡ต๐Ÿ‡นPortugal jcnventura

    Thanks for the patience. The correct path has been correctly provided as "jquery-datetimepicker" in the module's README.md file.

    However the homepage still used the old path (used in the 8.x-1.x branch). I've now fixed that.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia MukhtarM

    @jcnventura you can consider granting credits to the people who have contributed :)

  • Status changed to Closed: duplicate about 1 month ago
  • ๐Ÿ‡ต๐Ÿ‡นPortugal jcnventura

    To be honest, this whole issue is just a mess. The only reason I saw it was because @EricVL mentioned it in ๐Ÿ› Library name issue (datetimepicker vs. jquery-datetimepicker) Fixed where I fixed the problem.

    The only person in this issue that provided the correct answer to the problem was @k.prozorov in #7 and #8. I will give him credit for that.

Production build 0.69.0 2024