Skip to content

Question about the find method inside timezone.js #277

@qitang

Description

@qitang

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!

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions