amsul / amsul/pickadate.js

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

Aperta
#742 1 commento 2 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
7.6k
Fork
981
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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 || {};
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.