adopted-ember-addons / ember-moment

MIT License
399 stars 122 forks source link

Way of customizing long date formats ? #233

Closed dossorio closed 7 years ago

dossorio commented 7 years ago

Hi @stefanpenner ! Thanks for the addon, its being really useful !

I was wondering how you would say we should customize long date formats as shown here

For now we followed the approach you describe here, the only thing is that we are not able to use the moment service you expose, because there is no way to call updateLocale in moment's instance through it.

So we ended up importing moment directly:

// app/routes/applicaton.js

import moment from 'moment';

export default Ember.Route.extend({

  beforeModel() {
    moment.updateLocale('en-gb', {
      longDateFormat : {
       .......
      }
    });
  },
});

Is this the intended way of customizing other stuff in moment ? Might it be interesting to give access to moment's instance from the service for these cases or something like that ?

Thanks !!!

jasonmit commented 7 years ago

@dossorio that looks like a fine way to update the locale data. Feel free to send over a PR if you would like to add updateLocale to the service if you find it valuable.