When moment-timezone is istalled as npm package:
npm install moment-timezone --save
and imported like this:
import * as moment from 'moment-timezone';
it imports also all data.
In the documentation, provide an example, how to import it without data
Here's how I do it:
import moment from 'moment-timezone/moment-timezone';
It's not the official way (I couldn't find it in the docs either), so there is no guarantee it'll work in a future release of the library.
... would love to know how to tackle this. Is there some other package from npm that has just the +- 5 year data, like is available via CDN?
You can also you moment-timezone-data-webpack-plugin to specify exact year ranges and timezones - webpack will take care of the rest :)
How do we do that in react-native? We don't use webpack there.. :/
Most helpful comment
Here's how I do it:
import moment from 'moment-timezone/moment-timezone';It's not the official way (I couldn't find it in the docs either), so there is no guarantee it'll work in a future release of the library.