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

Cannot set default timezone #892

Open
gongAll opened this issue Jul 27, 2020 · 4 comments
Open

Cannot set default timezone #892

gongAll opened this issue Jul 27, 2020 · 4 comments

Comments

@gongAll
Copy link

gongAll commented Jul 27, 2020

Can't set moment.tz.setDefault

require('moment').version // 2.24.0
require('moment') === require('moment-timezone') // true

require('moment').version // 2.25.3
require('moment') === require('moment-timezone') // false

require('moment').version // 2.26.0
require('moment') === require('moment-timezone') // false

require('moment').version // 2.27.0
require('moment') === require('moment-timezone') // false

Since version 2.24.0 we cannot set timezones.

Hence, if I do:

require('moment-timezone').tz.setDefault(...)

it will reflect on moment for v2.24.0, but not for v2.25.0>.

Followup of moment/moment#4236

@gongAll gongAll changed the title Followup of #4236 Cannot set timezone Jul 27, 2020
@gongAll gongAll changed the title Cannot set timezone Cannot set default timezone Jul 27, 2020
@Nr9
Copy link

Nr9 commented Aug 20, 2020

same problem

@marwahaha marwahaha transferred this issue from moment/moment Sep 15, 2020
@ichernev
Copy link
Contributor

I can't reproduce with latest moment + moment-timezone. What could be happening is that you have different modules with different versions of moment, and that can cause big trouble (i.e require('moment') uses one version of moment, so it has it's global state, but require('moment-timezone') depends on another version of moment, with another global state, and when you set the default timezone it applies to one version of moment and not the other.

@ichernev
Copy link
Contributor

We could possibly switch to peerDependency for moment-timezone, so it doesn't pick it's own version by default and forces users to specify a moment version.

@Junaid20001
Copy link

can you assign this project to me

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

No branches or pull requests

5 participants