Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moment.tz.setDefault() #29

Open
cfaherty opened this issue Jun 7, 2024 · 0 comments
Open

moment.tz.setDefault() #29

cfaherty opened this issue Jun 7, 2024 · 0 comments

Comments

@cfaherty
Copy link

cfaherty commented Jun 7, 2024

Hi. The 2.0 BETA will call moment.tz.setDefault(userFormatOptions.timezone), for example in getAvailabilities().

There is a bit of a SNAFU with moment-tz in that setDefault will change all moment modules to that timezone. This affects the use of all moment modules. Hence, calling getAvailabilities() will affect the use of moment() throughout the project. For example, check moment().utcOffset() before and after the call. It normally would reflect your browser's timezone, but after getAvailabilities() it will reflect the parseTimezone option.

https://momentjs.com/timezone/docs/#/using-timezones/default-timezone/
moment/moment#3754

Not sure of the best remedy. Perhaps call moment.tz.setDefault() afterwards to reset it? Or maybe setDefault() is too dangerous to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant