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

Question about the find method inside timezone.js #277

Open
qitang opened this issue Feb 20, 2017 · 2 comments
Open

Question about the find method inside timezone.js #277

qitang opened this issue Feb 20, 2017 · 2 comments
Assignees
Labels

Comments

@qitang
Copy link

qitang commented Feb 20, 2017

Hi,
I have a question about the find function.

 for (j = year + 1; j >= year - off; --j)
        for (i = 0, I = rules.length; i < I; i++)
          if (rules[i].from <= j && j <= rules[i].to) actualized.push(actualize(entry, rules[i], j));
          else if (rules[i].to < j && off == 1) off = j - rules[i].to;
      actualized.sort(function (a, b) { return a.sort - b.sort });
      for (i = 0, I = actualized.length; i < I; i++) {
        if (time >= actualized[i][clock] && actualized[i][actualized[i].clock] > entry[actualized[i].clock]) found = actualized[i];
      }

So if year = 2017, it seems like the FOR statement is iterating all the years from 2018, 2017, 2016 ... to 2005. May I know why you need to do this, can we only iterate rules for year 2017 in this case?
Thanks!

@bigeasy bigeasy self-assigned this Nov 15, 2017
@bigeasy bigeasy added this to the Slippin' Into the Future milestone Nov 15, 2017
@bigeasy
Copy link
Owner

bigeasy commented Nov 15, 2017

Sorry for the delay. I can't remember why. I'll stare at the code this weekend and wait for it to come back to me or else apply your suggested optimization.

@ryami333
Copy link

Heya, did you find a resolution here @bigeasy? This library looks like it would be immensely useful to me, but unfortunately the lack of API documentation has reeeeeally slowed me down.

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

No branches or pull requests

3 participants