vitalets/combodate

Moment Construction Deprecation

Closed this issue · 3 comments

Hey, so I don't have an exact time as to when this message started popping up, but recently I've been getting the following message when instantiating a new combodate:

 Deprecation warning: moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.

It doesn't point to the specific line of code that is causing the issue, but here's the context that it was called from:

this.$().find('.dob-dropdown').combodate({
          value: moment(currentDate, "YYYY-M-D"),   //toString resolves to "Mon Mar 25 1985 00:00:00 GMT-0500"
          firstItem: 'none',
          minYear: 1898,
          maxYear: moment().format('YYYY'),  //Resolves to "2014"
          smartDays: true
        });

I've tested each of the two moment constructors used in building the attributes for this combodate and they were both able to resolve with no deprecation warning, so this leads me to believe it might be happening somewhere in the constructor of the combodate itself or it's associated methods.

Using:
Combodate 1.0.7
Moment 2.8.4

Hi @Garlandicus

can catch this bug. I've prepared jsfiddle, could you try to demonstrate bug here:
http://jsfiddle.net/5m6gG/61/

Hey Vitalets, I'm not sure what might have changed between now and then, or perhaps I was debugging into the wrong file, but the warning no longer seems to appear, and the combodate is still functioning as expected.

ok, thanks anyway!