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

Break after until #354

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/iter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function iter <M extends QueryMethodTypes> (iterResult: IterResult<M>, op
}

let counterDate = DateTime.fromDate(dtstart)
const endYear = until ? DateTime.fromDate(until).year : dateutil.MAXYEAR

const ii = new Iterinfo(options)
ii.rebuild(counterDate.year, counterDate.month)
Expand Down Expand Up @@ -100,8 +101,11 @@ export function iter <M extends QueryMethodTypes> (iterResult: IterResult<M>, op
// Handle frequency and interval
counterDate.add(options, filtered)

if (counterDate.year > dateutil.MAXYEAR) {
return emitResult(iterResult)
if (counterDate) {

if (counterDate.year > endYear) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please collapse these 2 if statements into if (counterDate && counterDate.year > endYear)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should take it despite that now no?

return emitResult(iterResult)
}
}

if (!freqIsDailyOrGreater(freq)) {
Expand Down