urish / angular-moment

Moment.JS directives for Angular.JS (timeago and more)
MIT License
2.6k stars 397 forks source link

Warning for changeTimeZone #242

Closed lnu closed 8 years ago

lnu commented 8 years ago

Since upgrading to the latest version we get this warning:

angular-moment: changeTimezone() works only with moment-timezone.js v0.3.0 or greater.

In the preprocessDate function there is this code:

if (defaultTimezone !== angularMomentConfig.timezone) {
    this.changeTimezone(angularMomentConfig.timezone);
}

In our case, defaultTimeZone is null and angularMomentConfig.timezone is undefined. We should not enter the condition

lnu commented 8 years ago

Sorry, this was our fault.

I had this code:

    // angular-moment config
    app.constant('angularMomentConfig', {
    });

It's better to use this one as it keeps the default values:

    // angular-moment config
    app.config(['angularMomentConfig', function (angularMomentConfig) {
    }]);

That's why it was undefined