moment / moment-timezone

Timezone support for moment.js
momentjs.com/timezone
MIT License
3.83k stars 837 forks source link

How to use moment-timezone with moment without locales or moment-mini #786

Open F0b0s opened 5 years ago

F0b0s commented 5 years ago

Hello, are there any possibility to use moment-timezone with moment without locales(or maybe with subset of locales) or moment-mini? I would like to reduce bundle size.

parth391 commented 2 years ago

@Frost, Did you find any solution?

F0b0s commented 2 years ago

no :(

ichernev commented 2 years ago

@F0b0s well, I've been thinking of making moment-timezone a proper plugin that gets passed a moment instance, that would probably work with tiny moment (of course if moment-timezone uses locale API it won't), but you get the idea.

You can fork the repo and tweak it slightly so moment-timezone "adds" .tz only for a passed in moment and not from imported moment, and give it a go, then report your findings.

ichernev commented 2 years ago

To be fair importing moment shouldn't import any locales, maybe if you're using some fancy package manager that is dumb and puts locales in anyway, you can just instruct it not to...