adopted-ember-addons / ember-moment

MIT License
400 stars 122 forks source link

ES6 moment doesn't use correct defaultFormat #294

Closed leobut closed 5 years ago

leobut commented 5 years ago

I have the following definition for moment in my environment.js:

moment: {
      includeLocales: ['is'],
      outputFormat: 'YYYY-MM-DDTHH:mm:ss'
}

The outputFormat is correctly applied to {{moment-format}}, but not to the moment object that can be used in ES6.

I import the moment object like this import moment from 'moment'; and use it like this in an action inside a component this.set('data.myDateAsString', moment(dateObjectFromUi).format());. The output that I get is formatted in the original default format and not in the default format that I defined in the environment.js.

Used Versions:

jasonmit commented 5 years ago

outputFormat config option is used only in helpers and computeds. Not when interfacing with the moment API directly. This is behaving as expected.