django-bootstrap-datepicker-plus
django-bootstrap-datepicker-plus copied to clipboard
`dp.change` event doesn't seem to be emitted
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:
- Unpack the attached MRE.
- Run
python manage.py runserver
- Go to http://localhost:8000
- 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.