benitolopez / hotel-datepicker

Date range picker for hotels
https://hoteldatepicker.org
MIT License
311 stars 98 forks source link

Doesn't work at all #76

Closed mzengine closed 5 years ago

mzengine commented 5 years ago

According to your description I should add those two file fecha and hotel-datepicker to my script tag but I have this errors there : Uncaught SyntaxError: Unexpected token export

So, I change the type into module like this

That error Uncaught SyntaxError: Unexpected token export is gone but I have another error called: Uncaught ReferenceError: HotelDatepicker is not defined

So soome how it does not load the class at all. In your description how to use this says only download the files and add them to your script but It DOESN'T WORK according to your description.

Can you tell me what are the steps to get it work? Thanks.

benitolopez commented 5 years ago

Hi,

Yes, it works and you need to include the files in that way:

<script src="/path/to/fecha.js"></script>
<script src="/path/to/hotel-datepicker.min.js"></script>

You don't need the type "module" at all. So be sure that your paths are correct.

If it doesn't work, please share the URL of your page here.

mzengine commented 5 years ago

Hi, Sorry but i did include my path as you can see : without that module it won't load and is coming back with error. It's on my localhost so I can't share the path. Sorry but this date picker doesn't work at all. Like I said there are errors that can't load and after include "module" its coming back with different errors.

jquery-3.4.1.min.js:2 Uncaught ReferenceError: HotelDatepicker is not defined at HTMLDocument. (main.js:24) at e (jquery-3.4.1.min.js:2) at t (jquery-3.4.1.min.js:2)

benitolopez commented 5 years ago

Hi,

The datepicker works. It's not working on your website, this is a different story.

Again: can you share the URL of your page here? I need the URL, otherwise it is impossible to help you.

mzengine commented 5 years ago

http://php-booking.localdomain.ee/

I don't think you can see this as its on localhost

benitolopez commented 5 years ago

Ok just seen the edit. You're on localhost.

Try this:

  1. Include the scripts without "module" (don't use anything, like I wrote above)
  2. Use an absolute path, like "http://localhost/include/theme/elite/javaScript/fecha.js"
  3. To be sure that the path is correct, open a new window of your browser and visit the same path (http://localhost/include/theme/elite/javaScript/fecha.js). If you see the code, it means that the path is correct. If you see an error, the path is not correct and that's your problem.
mzengine commented 5 years ago

the path is correct because when I click on the link src it will open a window and show me the whole file.

mzengine commented 5 years ago

if you read that error that I have post you realize that jquery can't load this so there is something wrong with the installation the way you said it needs to be install. I think there missing files that you forgot to mentioned plus how to use in the file.

I'm using the new version of Jquery 3.4.1 without that type="module" it won't load any of the fecha or date-picker but =after that it will show the error that datepicker is not define so yeah it doesn't work sorry.

benitolopez commented 5 years ago

No, absolutely. There is no missing information. This plugin has 3 years and this is the first time that I see this problem. Just check the issues if you don't trust me.

There's probably an error on your installation. So please stop to insinuate that I'm not reading your comments and all of that. Because I'm here during my work break trying to help you.

Anyway, just uploaded a test here: http://lopezb.com/hoteldatepicker/test/

Everything works correctly. With jQuery 3.4.1 and following the installation instructions. Nothing else. Check the source code.

benitolopez commented 5 years ago

Please make a public accessible installation of your setup. When done, share the URL here.

mzengine commented 5 years ago

no need to get angry. Your files are wrong and not explain how to use it as I inspect your file that you are using in your test start like this:

/! hotel-datepicker 3.6.9 - Copyright 2019 Benito Lopez (http://lopezb.com) - https://github.com/benitolopez/hotel-datepicker - MIT / var HotelDatepicker = function() { "use strict"; var t = 0, e = function t(e, s) { this._boundedEventHandlers = {}, this.id = t.getNewId(); var a = s || {};

Now the file that are here in the src start like this:

*'use strict'; / global fecha, DocumentTouch / / eslint-disable no-multi-assign */ let idCounter = 0;

export default class HotelDatepicker { constructor(input, options) { this._boundedEventHandlers = {}; this.id = HotelDatepicker.getNewId();

    // Set default values
    const opts = options || {};

**

you see the difference? When I have used those files that you are using in your test then now it works but when I used yours here in git then it doesn't work work. you try with those files that you have here and you will see the difference.

Thanks anyway for your time and now it works as I have use your files that you are using in your test. Regards

PS: maybe you should have look on your files on src/js/hotel-datepicker.js

benitolopez commented 5 years ago

Well of course, the src folder is the development one. You obviously need to use the files included in the dist folder. Like in other libraries. This is a common practice.

Anyway, the instructions say that you need to include this file:

<script src="/path/to/hotel-datepicker.min.js"></script>

There is not any hotel-datepicker.min.js file in the src folder. It's in the dist folder. So the instructions are correct.

PS: The files on src are for development purposes as I said. Those are compiled and they generate the dist folder. So everything is ok there.