-
Notifications
You must be signed in to change notification settings - Fork 838
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
Problem with addLinks method #301
Comments
What do you need the filtered list for? Perhaps we can design a better api that can do this filtering for you. |
I'm using it to populate a select form element but when you populate it based on the links[normal0] = normal1; If you watch what the loop is doing this value would be overwritten with each link that shares the same name anyways. So you end up with an array of 160 instead of 80. I commented out that line and it fixed the issue for me. |
We maintain a list of approximate populations for many timezones that could also be used to filter the list. We could also consider adding a I agree that we need to provide some sort of filtering, but I don't think the internal |
This problem ended up causing a bug in a webpack plugin that makes heavy use of
When using
If any code then tries to use
In light of the above, is there a need to populate |
The bi-directional linking (with the potential overriding of a prior link due to the 1:many relationship of the "main" timezone and linked timezones) makes resolving what the main timezone is almost impossible. When using the It would be nice if the |
@gilmoreorless hm, this is a longstanding issue. Bidirectional linking makes some sense, but it should work more like equivalence sets than what it is now. So if you have A --link-- B, you have one equivalence set (AB) with 2 participants. You can represent that with a consecutive number for equivalence set (like 0) and list of zones in it:
So when you need to add another link (say B --link-- C), you'd get
And I'm guessing you can assume the first one in the list is the "main" / primary one. You could represent it as a proper graph, but I fail to see the usefulness in that... |
In the addLinks method around line 426 there is the following code:
Does this technically add a link that doesn't need to be there since
links[normal0]
is really the one they are all linking to? It might be by design and perhaps I'm not understanding how it works.The reason it was causing me problems is I was wanting to get a shortened list of
moment.tz.names()
based on the links but it kept coming out twice as long as it needed to be when I usedmoment.tz._links
to filter it. Does that make sense?The text was updated successfully, but these errors were encountered: