bigeasy / bigeasy/timezone

Question about the find method inside timezone.js

Open
#277 2 comments 0 reactions 1 assignee Claimed by @bigeasy View on GitHub
question
Dominant language
JavaScript
Stars
256
Forks
26
PR merge metrics
No merged PRs in 30d

Description

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!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.