vitalets / combodate

Dropdown date and time picker
http://vitalets.github.com/combodate
207 stars 82 forks source link

Moment 2.4.0 Compatibility #15

Closed TheBox193 closed 5 years ago

TheBox193 commented 10 years ago

There seems to be a compatibility issues with Moment version 2.4.0 due to the deprecated support of a globally scoped moment.

Line 146 relTime = moment.relativeTime || moment.langData()._relativeTime; Makes use of moment.langData() which is not available any longer and resulting in the error:

Uncaught TypeError:
Object function (){
return!b&&console&&console.warn&&(b=!0,console.warn("
Accessing Moment through the global scope is deprecated, 
and will be removed in an upcoming release.")),c.apply(null,arguments)}
 has no method 'langData' 

See also: moment/moment/issues/334

I did some initial digging searching for the proper alternative, but have no answer of yet. Will submit a pull if I resolve. For now I'm on Moment 2.3.1 that still provides backwards compatibility.

vitalets commented 10 years ago

hi, works for me with moment 2.5.0. could you re-check and if issue repeats - make fiddle? thx

samkelleher commented 9 years ago

moment no longer exports the moment global, especially when it executed via AMD. So calling $(element).combodate() will not work when moment has been loaded by AMD. The jQuery plugin can be wrapped in an AMD compatible loader (https://gist.github.com/simonsmith/4353587 for example) to define the moment dependency when operating within AMD environments.