File tree 2 files changed +11
-5
lines changed
bootstrap_datepicker_plus/static/bootstrap_datepicker_plus/js
dev/myapp/templates/layouts
2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 8
8
} ( function ( $ ) {
9
9
var datepickerDict = { } ;
10
10
var isBootstrap4 = $ . fn . collapse . Constructor . VERSION . split ( '.' ) . shift ( ) === "4" ;
11
+ var isBootstrap5 = $ . fn . collapse . Constructor . VERSION . split ( '.' ) . shift ( ) == "5" ;
11
12
function fixMonthEndDate ( e , picker ) {
12
13
e . date && picker . val ( ) . length && picker . val ( e . date . endOf ( 'month' ) . format ( 'YYYY-MM-DD' ) ) ;
13
14
}
24
25
data . $element . next ( '.input-group-addon' ) . on ( 'click' , function ( ) {
25
26
data . datepickerdata . show ( ) ;
26
27
} ) ;
27
- if ( isBootstrap4 ) {
28
+ if ( isBootstrap4 || isBootstrap5 ) {
28
29
data . $element . on ( "dp.show" , function ( e ) {
29
30
$ ( '.collapse.in' ) . addClass ( 'show' ) ;
30
31
} ) ;
66
67
}
67
68
$ ( function ( ) {
68
69
$ ( "[dp_config]:not([disabled])" ) . djangoDatetimePicker ( ) ;
69
- if ( isBootstrap4 ) {
70
+ if ( isBootstrap4 || isBootstrap5 ) {
70
71
$ ( 'body' ) . on ( 'show.bs.collapse' , '.bootstrap-datetimepicker-widget .collapse' , function ( e ) {
71
72
$ ( e . target ) . addClass ( 'in' ) ;
72
73
} ) ;
73
74
$ ( 'body' ) . on ( 'hidden.bs.collapse' , '.bootstrap-datetimepicker-widget .collapse' , function ( e ) {
74
75
$ ( e . target ) . removeClass ( 'in' ) ;
75
76
} ) ;
76
77
}
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
+ }
77
84
} ) ;
78
85
} ) ) ;
Original file line number Diff line number Diff line change 9
9
{% block extra_css %}
10
10
{% endblock %}
11
11
</ head >
12
-
13
12
< body >
14
13
< nav class ="navbar navbar-expand-lg navbar-light bg-light ">
15
14
< a class ="navbar-brand " href ="https://github.com/monim67/django-bootstrap-datepicker-plus ">
@@ -42,10 +41,10 @@ <h4 class="alert-heading">Not supported!</h4>
42
41
</ div >
43
42
{% endif %}
44
43
</ div >
45
-
44
+
46
45
{% bootstrap_javascript jquery='full' %} {# Embed Bootstrap JS+jQuery #}
47
46
{% block extra_js %}
48
47
{% endblock %}
49
48
</ body >
50
49
51
- </ html >
50
+ </ html >
You can’t perform that action at this time.
0 commit comments