Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dp.change event doesn't seem to be emitted #120

Open
egor83 opened this issue Aug 16, 2024 · 3 comments
Open

dp.change event doesn't seem to be emitted #120

egor83 opened this issue Aug 16, 2024 · 3 comments

Comments

@egor83
Copy link

egor83 commented Aug 16, 2024

Describe the bug
Changing values in the datetime picker input emits change event, but not the dp.change.

I recently updated our project's django-bootstrap-datepicker-plus version from 4.0.0 to 5.0.5. After that, the code that listened to dp.change event has stopped working.
In the MRE, I added a JS function to change the end datetime value to start datetime value + 30 minutes (see base_app/templates/base_app/index.html, line 25).

But basically, this snippet shows what's wrong:

    $("#id_start_datetime").on("dp.change", function() {console.log("dp.change");});
    $("#id_start_datetime").on("change", function() {console.log("change");});

The second line works (once I change the value and press "Enter"); the first one does not.

To Reproduce
Steps to reproduce the behavior:

  1. Unpack the attached MRE.
  2. Run python manage.py runserver
  3. Go to http://localhost:8000
  4. Click on the "start datetime" field and change its value.

Expected behavior
I expect the end datetime value to change to the start datetime + 30 minutes.
It does work initially, the end datetime value is set to the start datetime + 30 minutes.
It does NOT change when I change the start datetime value using datepicker controls. If I change the value manually and press "Enter", the change event is emitted and the end datetime is changed (as it should).

Setup Information (please complete the following information):

  • OS: Linux (Ubuntu 20.04.6 LTS)
  • Browser: Chrome
  • Browser version: Version 127.0.6533.99 (Official Build) (64-bit)
  • Python version: 3.11.9
  • Django version: 4.2.15
  • Bootstrap version: 4
  • jQuery version: 3.5.1

[x] I have followed the configuration instructions and checked out the
common error troubleshooting page: "configuration instructions" page returns 404 (also in the docs), but I have checked the troubleshooting page.

@egor83
Copy link
Author

egor83 commented Aug 16, 2024

PS I included the workaround for the issue #116 described here.

@egor83
Copy link
Author

egor83 commented Aug 16, 2024

PPS Forgot to attach the MRE: datepicker_bug_mre_20240816.zip

@egor83
Copy link
Author

egor83 commented Aug 20, 2024

(Downgrading back to 4.0.0 solved the problem.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant