File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
bootstrap_datepicker_plus/static/bootstrap_datepicker_plus/js
dev/myapp/templates/layouts Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 88} ( function ( $ ) {
99 var datepickerDict = { } ;
1010 var isBootstrap4 = $ . fn . collapse . Constructor . VERSION . split ( '.' ) . shift ( ) === "4" ;
11+ var isBootstrap5 = $ . fn . collapse . Constructor . VERSION . split ( '.' ) . shift ( ) == "5" ;
1112 function fixMonthEndDate ( e , picker ) {
1213 e . date && picker . val ( ) . length && picker . val ( e . date . endOf ( 'month' ) . format ( 'YYYY-MM-DD' ) ) ;
1314 }
2425 data . $element . next ( '.input-group-addon' ) . on ( 'click' , function ( ) {
2526 data . datepickerdata . show ( ) ;
2627 } ) ;
27- if ( isBootstrap4 ) {
28+ if ( isBootstrap4 || isBootstrap5 ) {
2829 data . $element . on ( "dp.show" , function ( e ) {
2930 $ ( '.collapse.in' ) . addClass ( 'show' ) ;
3031 } ) ;
6667 }
6768 $ ( function ( ) {
6869 $ ( "[dp_config]:not([disabled])" ) . djangoDatetimePicker ( ) ;
69- if ( isBootstrap4 ) {
70+ if ( isBootstrap4 || isBootstrap5 ) {
7071 $ ( 'body' ) . on ( 'show.bs.collapse' , '.bootstrap-datetimepicker-widget .collapse' , function ( e ) {
7172 $ ( e . target ) . addClass ( 'in' ) ;
7273 } ) ;
7374 $ ( 'body' ) . on ( 'hidden.bs.collapse' , '.bootstrap-datetimepicker-widget .collapse' , function ( e ) {
7475 $ ( e . target ) . removeClass ( 'in' ) ;
7576 } ) ;
7677 }
78+ if ( isBootstrap5 ) {
79+ $ ( '.input-group-addon[data-target="#datetimepicker1"]' ) . each ( function ( ) {
80+ $ ( this ) . attr ( 'data-bs-target' , '#datetimepicker1' ) . removeAttr ( 'data-target' )
81+ $ ( this ) . attr ( 'data-bs-toggle' , 'datetimepickerv' ) . removeAttr ( 'data-toggle' )
82+ } )
83+ }
7784 } ) ;
7885} ) ) ;
Original file line number Diff line number Diff line change 99 {% block extra_css %}
1010 {% endblock %}
1111</ head >
12-
1312< body >
1413 < nav class ="navbar navbar-expand-lg navbar-light bg-light ">
1514 < a class ="navbar-brand " href ="https://github.com/monim67/django-bootstrap-datepicker-plus ">
@@ -42,10 +41,10 @@ <h4 class="alert-heading">Not supported!</h4>
4241 </ div >
4342 {% endif %}
4443 </ div >
45-
44+
4645 {% bootstrap_javascript jquery='full' %} {# Embed Bootstrap JS+jQuery #}
4746 {% block extra_js %}
4847 {% endblock %}
4948</ body >
5049
51- </ html >
50+ </ html >
You can’t perform that action at this time.
0 commit comments