amsul / amsul/pickadate.js

Check whether $.fn.pickadate and $.fn.pickatime have been defined before set up translations

未關閉
#742 1 則留言 2 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
7.6k
分支
981
PR 合併指標
30 天內沒有已合併 PR

描述

When I only include picker.js, picker.date.js, and translations/zh_CN.js, it produces an error: `TypeError: jQuery.fn.pickatime is undefined`.

It's better to check whether $.fn.pickadate and $.fn.pickatime have been defined before using them.

```
if (jQuery.fn.pickadate){
jQuery.extend( jQuery.fn.pickadate.defaults, {
});
}

if (jQuery.fn.pickatime){
jQuery.extend( jQuery.fn.pickatime.defaults, {
});
}
```

Or, we could set a default value to make sure they exists.

```
jQuery.fn.pickadate = jQuery.fn.pickadate || {};
jQuery.fn.pickatime = jQuery.fn.pickatime || {};
```

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。