Tempus-dominus: Not working on jquery 3

Created on 7 Jul 2016  路  16Comments  路  Source: Eonasdan/tempus-dominus

jquery.js:2 jQuery.Deferred exception: input.size is not a function TypeError: input.size is not a function
at dateTimePicker (https://192.168.99.247/sv/uContact/assets/js/vendor/bootstrap/bootstrap-datetimepicker.js:1604:23)
at HTMLDivElement. (https://192.168.99.247/sv/uContact/assets/js/vendor/bootstrap/bootstrap-datetimepicker.js:1657:46)
at Function.each (https://192.168.99.247/sv/uContact/assets/js/vendor/jquery/jquery.js:2:2813)
at r.each (https://192.168.99.247/sv/uContact/assets/js/vendor/jquery/jquery.js:2:1003)
at r.$.fn.datetimepicker (https://192.168.99.247/sv/uContact/assets/js/vendor/bootstrap/bootstrap-datetimepicker.js:1652:21)
at HTMLDocument. (:24:31)
at j (https://192.168.99.247/sv/uContact/assets/js/vendor/jquery/jquery.js:2:29588)
at k (https://192.168.99.247/sv/uContact/assets/js/vendor/jquery/jquery.js:2:29902) undefined

Most helpful comment

PR #1664 resolve issues the important here apart of the size to length is change widget.show() to widget.css('display', 'block');

All 16 comments

Work-around is to also load jquery-migrate-3.0.0.js

still not working

Broken with the same error with jQuery 3.1 and jquery-migrate-1.4.1 as well: (there is no such thing as jquery-migrate-3.0.0.js; 1.4.1 is current). It really doesn't like that size call:

migrateWarn (jquery-migrate-1.4.1.js:47)
size (jquery-migrate-1.4.1.js:377)
dateTimePicker (g=cj&1464952597:709:165)
(anonymous function) (g=cj&1464952597:716:241)
each (jquery-3.1.0.min.js:2:2820)
each (jquery-3.1.0.min.js:2:1008)
datetimepicker (g=cj&1464952597:716)
(anonymous function) (373515:1719)
j (jquery-3.1.0.min.js:2:29574)
(anonymous function) (jquery-3.1.0.min.js:2:29884)

Changing the two uses of .size() to .length prevents the migrate errors, but doesn't make it work. With those fixed it does nothing, no errors or warnings are logged.

FYI, jquery-migrate-3.0.0.js is the correct file restores deprecated features and behaviors/troubleshooting for jquery-3.x.0.js. jquery-migrate-1.4.1.js is the version restores deprecated features and behaviors for jquery v2.x/1/x for much older jquery versions. jquery-migrate v3.0.0 and v1.4.1 are incompatible with each other.
https://code.jquery.com/jquery-3.1.0.min.js
https://code.jquery.com/jquery-migrate-3.0.0.min.js

Apologies, you are correct.

PR #1664 resolve issues the important here apart of the size to length is change widget.show() to widget.css('display', 'block');

Thanks @scgm11 - I can confirm that that change makes it all work for me in jQuery 3.1.

@scgm11 Thanks that does the trick!

@scgm11 thanks!

@dleffler Thanks. The 'adding jquery-migrate-3.0.0.min.js' workaround worked for my project.

The error I got was: '.... e.size is not a function...'

Here are what I did:

Tried to use the 'widget.css('display', 'block');' trick, didn't work.
Added jquery-migrate-3.0.0.min.js, then worked

Thanks

I added jquery migrate and it fixed the size issue in console but when i try click the calendar button, nothing gets displaed.

yep it's still an issue there is a fix applied here https://github.com/Eonasdan/bootstrap-datetimepicker/pull/1664 but it's failing on the unit test so it hasn't been merged

@scgm11

PR #1664 resolve issues the important here apart of the size to length is change widget.show() to widget.css('display', 'block');

I believe this issue has been reported here #1765 along with a CSS hack.

some truble

I think this is fixed in 0202134
Version 4.17.42 is working for me with jquery 3.1.0

Was this page helpful?
0 / 5 - 0 ratings