这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@okonomiyaki3000
Copy link

Loading a translation file could cause js errors in the case that you have not loaded both picker.date.js and picker.time.js. It should not be necessary to load a time picker if you only need a date picker and vice versa. By checking first, it is now safe to load a translation even if you are using only one or the other.

@DanielRuf
Copy link
Contributor

Related: #744

@okonomiyaki3000
Copy link
Author

In case it's not obvious why this solution works, the expression:

jQuery.fn.pickadate && jQuery.fn.pickadate.defaults

might look like it should return a boolean but it does not in javascript. If the left side is falsy, it returns the left side without evaluating the right. If the left side is truthy, it returns the right side. So what really happens here is, if pickadate is a defined key on jQuery.fn, then the defaults object is returned (and subsequently extended). If pickadate is not defined, it resolves as falsy and we don't try to do anything with the (obviously) undefined pickadate.defaults.

@DanielRuf
Copy link
Contributor

DanielRuf commented Feb 14, 2018

@okonomiyaki3000
Copy link
Author

It's a floor wax AND a dessert topping!

@okonomiyaki3000
Copy link
Author

@DanielRuf Do you see why it works?

@DanielRuf DanielRuf self-requested a review February 19, 2018 08:45
package.json Outdated
{
"name": "pickadate",
"version": "3.5.6",
"version": "3.5.7",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not change the version of pickadate.

@DanielRuf DanielRuf self-requested a review April 1, 2018 21:55
Copy link
Contributor

@DanielRuf DanielRuf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the version change.

@okonomiyaki3000
Copy link
Author

Reverted. Also rebased with the latest master.

@amsul
Copy link
Owner

amsul commented Apr 3, 2019

As mentioned in the other PR, fixing the order of the imports is the correct fix. Otherwise your translations wouldn't work properly.

@amsul amsul closed this Apr 3, 2019
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

Successfully merging this pull request may close these issues.

3 participants