Skip to content

Conversation

@minichma
Copy link
Collaborator

@minichma minichma commented Mar 9, 2025

In cases where BYWEEKNO=1 is specified, week no 1 may start in the year prior to the one it belongs to. If both, the last occurrence and UNTIL lie in the year prior to the year the corresponding week belongs to, UNTIL has not been handled correctly, which is fixed with this PR.

E.g. the following case is fixed, which was missing the last instance prior to the fix:

# BYWEEKNO 1 - UNTIL and the last recurrence are in 2024 while the week is 1 of 2025.
RRULE:FREQ=YEARLY;BYWEEKNO=1;BYDAY=MO;UNTIL=20241230
DTSTART:20240101
INSTANCES:20240101,20241230

fixes #751

@codecov
Copy link

codecov bot commented Mar 9, 2025

Codecov Report

Attention: Patch coverage is 95.45455% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
Ical.Net/Evaluation/RecurrencePatternEvaluator.cs 95% 0 Missing and 1 partial ⚠️

❌ Your project status has failed because the head coverage (66%) is below the target coverage (80%). You can increase the head coverage or adjust the target coverage.

Impacted file tree graph

@@         Coverage Diff         @@
##           main   #752   +/-   ##
===================================
  Coverage    66%    66%           
===================================
  Files       104    104           
  Lines      4611   4617    +6     
  Branches   1146   1147    +1     
===================================
+ Hits       3047   3055    +8     
  Misses     1129   1129           
+ Partials    435    433    -2     
Files with missing lines Coverage Δ
Ical.Net/Evaluation/RecurrencePatternEvaluator.cs 91% <95%> (+<1%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@minichma minichma force-pushed the work/minichma/bugfix/until_weekno1 branch from 2a297a0 to dee8ef0 Compare March 9, 2025 21:15
@minichma minichma marked this pull request as ready for review March 9, 2025 21:16
@minichma minichma requested a review from axunonb March 9, 2025 21:16
@minichma minichma force-pushed the work/minichma/bugfix/until_weekno1 branch from dee8ef0 to 5504cb4 Compare March 9, 2025 21:19
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 9, 2025

Copy link
Collaborator

@axunonb axunonb left a comment

Choose a reason for hiding this comment

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

Another edge case fixed, very good

}
}

private static CalDateTime? GetSearchEndDate(CalDateTime? periodEnd, RecurrencePattern pattern)
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UNTIL not handled correctly in case of BYWEEKNO=1

3 participants