ember-cli-moment-shim
ember-cli ES6 module shim for momentjs and moment timezone within your Ember applications. It will also conditionally bundle in specific locale/timezone data for those concerned about payload size.
Usage
ember install ember-cli-moment-shim
import moment from 'moment';
Features
- ES6 accessible module for moment
- Trim your build sizes by bundling locale & timezone data through simple configuration
- FastBoot support
Enabling moment-timezone
module.exports = function(environment) {
return {
moment: {
includeTimezone: 'all'
}
};
}
i18n support
Cherry pick locales (optimal)
module.exports = function(environment) {
return {
moment: {
includeLocales: ['es', 'fr-ca']
}
};
NOTE: English is bundled automatically – no need to add en
in includeLocales
Include all locales
module.exports = function(environment) {
return {
moment: {
includeLocales: true
}
};
Configure default runtime locale
import moment from 'moment';
export default Ember.Route.extend({
beforeModel() {
moment.locale('es');
}
});
Write all locales to a folder that is relative to dist
module.exports = function(environment) {
return {
moment: {
localeOutputPath: 'assets/moment-locales'
}
};
The feature set for i18n support within moment can be found here: http://momentjs.com/docs/#/i18n/
License
ember-cli-moment-shim shims is MIT Licensed.