makepanic / ember-power-calendar-date-fns

Internal utils of Ember Power Calendar built on top of date-fns
MIT License
2 stars 8 forks source link

Let user configure locale so we don't include all of date-fns/locale #10

Closed makepanic closed 4 years ago

makepanic commented 4 years ago

Probably by not including it by default and letting user overwrite its own somewhat like this:

import allLocales from 'date-fns/locale';
import deLocale from 'date-fns/locale/de';

// just load all, will bloat size
const locales = allLocales;

// just load one locale
const locales = {
  de: Locale
}

export default class PowerCalendarDays extends DaysComponent {
  locales;
}

This would also allow users to not use date-fns locales but also custom implementations, based on already used intl frameworks.

I think that there's also an easier solution. We could extract the date-fns/locale methods into a separate module and depending on the addon config, filter that module and use the unlocalized base instead.