jalaali / moment-jalaali

A Jalaali (Jalali, Persian, Khorshidi, Shamsi) calendar system plugin for moment.js.
MIT License
940 stars 162 forks source link

Moment-timezone Dependency #242

Open malikarami opened 2 years ago

malikarami commented 2 years ago

Hi,

I am trying to config Moment-Jalaali to format date and time based on a timezone, and I have noticed that Moment-Timezone is a dependency of Moment-Jalaali. Can you please explain the reason behind that? Is Moment-Jalaali really dependent on Moment-Timezone? If so, and if the package is installed, Why does Moment-Jalaali fail to support moment.tz()functionality?

I have also found out that moment().tz('example-timezone').format() works and converts the timestamps to the example timezone but if you use moment().tz('example-timezone') without the tagging format() function, it would trough an error.

Thanks in advance for noticing.

behrang commented 2 years ago

Hi,

The reason for dependency is surely for calculating the date and time in accordance to day-light saving rules. If the dependency was not there, the calculated date and time would be wrong.

About the tz function not working, I'm not sure that it even existed when this project was created. But if you are interested, we welcome pull-requests.

malikarami commented 2 years ago

So if the moment-timezone dependency is there and I suppose it is also adding to the final bundle size, why don't you (moment-jalaali) support the tz functionalities for Iran timezone?

About the PR, I noticed that someone had opened such a request but that was closed due to the fact that moment-timezone is a heavy package.

PS: Am I correct in assuming that in the projects that use moment-jalaali, the moment-timezone lib is also included in the final bundle?

behrang commented 2 years ago

If you are interested in working on this issue, check here: https://github.com/jalaali/moment-jalaali/pull/216#issuecomment-1256950515