ES6 accessible module for momentjs within your Ember applications.
- ember-cli < 0.2.3
ember install:addon ember-cli-moment-shim
- ember-cli >= 0.2.3
ember install ember-cli-moment-shim
import moment from 'moment';
// config.environment.js
module.exports = function(environment) {
return {
moment: {
// Options:
// 'all' - all years, all timezones
// '2010-2020' - 2010-2020, all timezones
// 'none' - no data, just timezone API
includeTimezone: 'all'
}
};
// config.environment.js
module.exports = function(environment) {
return {
moment: {
// To cherry-pick specific locale support into your application.
// Full list of locales: https://github.com/moment/moment/tree/2.10.3/locale
includeLocales: ['es', 'fr-ca']
}
};
// config.environment.js
module.exports = function(environment) {
return {
moment: {
includeLocales: true
}
};
// app/routes/applicaton.js
import moment from 'moment';
export default Ember.Route.extend({
beforeModel() {
// sets the application locale to Spanish
moment.locale('es');
}
});
Feature set of i18n support within moment can be found here: http://momentjs.com/docs/#/i18n/
ember-cli-moment-shim shims is MIT Licensed.