adopted-ember-addons / ember-moment

MIT License
399 stars 122 forks source link

moment-timezone include all data for specific timezone #303

Open fran-worley opened 5 years ago

fran-worley commented 5 years ago

Based on the options for including timezone data there doesn't appear to be a way to include all data for just one timezone. We only operate in the UK but hold data going back 20+ years so are currently having to import 'all'. It would reduce our build size if we could limit the import to just "Europe/London|Europe/Belfast".

Is there a way to do this?

jasonmit commented 5 years ago

There isn't an automatic way of doing this.

However, you can strip out the timezone data you need and manually register the data. Afterwards, be sure to set includeTimezone: "none".

Hopefully that help!

fran-worley commented 5 years ago

Thanks Jason,

I actually tried this originally but ran into issues where moment.tz was undefined so fell back to importing all. It's possible that I was attempting to manually register in the wrong place but either way I figured some docs might be useful for everyone given that build size is quite a hot topic with ember at the moment...

RobbieTheWagner commented 4 years ago

We're also looking for ways to reduce our build size, and moment-timezone is currently almost double the size of Ember itself in our bundle! Would love some suggestions on how to include less timezones and less locales for moment itself, etc.

jasonmit commented 4 years ago

@rwwagner90 Does this not cover your use case: https://github.com/jasonmit/ember-cli-moment-shim#cherry-pick-locales-optimal

RobbieTheWagner commented 4 years ago

@jasonmit that looks like it should work for locales. We currently have includeTimezone: 'all' as well though, so I assume we have to manually load timezone data? We don't actually want all timezones, I don't think, but I am not 100% sure which ones we do want now.

preethi-sathiyanarayanan commented 4 years ago

same here. a way to reduce the size due to timezone would be helpful