Skip to content

Opened by mistake, please ignore - #86

Closed
aaazlkm wants to merge 1 commit into
JonasWanke:mainfrom
aaazlkm:feature/weekly-wkst
Closed

Opened by mistake, please ignore#86
aaazlkm wants to merge 1 commit into
JonasWanke:mainfrom
aaazlkm:feature/weekly-wkst

Conversation

@aaazlkm

@aaazlkm aaazlkm commented Jul 18, 2026

Copy link
Copy Markdown

This pull request was opened by mistake while I was working on my fork.
It was not intended for the upstream repository and has been closed.
Please ignore this pull request.
Apologies for the noise and confusion.

Original auto-generated description

Summary

This restores WKST support for weekly frequencies — the golden tests for it were left commented out in rrule_ical_test.dart with a TODO(JonasWanke): Re-add these tests when we support WKST again, so I hope this is welcome!

Changes

  • Iteration: use actualWeekStart instead of hardcoded DateTime.monday in the two weekly-bucketing sites — the weekly date-set boundary (date_set.dart) and the weekly interval snap-back (frequency_interval.dart).
  • String decoder: accept any WKST weekday, and actually pass the parsed value to the RecurrenceRule constructor (it was previously parsed but dropped).
  • Model: relax the Monday-only constructor assert to isValidRruleDayOfWeek; include weekStart in ==/hashCode; add weekStart/clearWeekStart to copyWith.
  • Tests: re-enabled all the commented-out WKST tests, including the canonical RFC 5545 "days generated makes a difference because of WKST" pair (WKST=MO → Aug 5,10,19,24 vs WKST=SU → Aug 5,17,19,31). One fix: the previously commented golden for "Every other week - forever" listed February 18, but RFC 5545's own expected output is "February 3,17" (Feb 17 1998 is the Tuesday) — corrected with a comment. Also added python-dateutil-derived goldens (testWkStIntervalMO/SU equivalents), a WKST=TU case, string-codec round-trips for all seven weekdays, and equality/copyWith tests.

Verification beyond the unit tests

The weekly expansion was verified differentially against Android CalendarProvider's Instances table (the platform's own RRULE engine): identical instance lists for WKST=MO/SU/TU weekly rules at INTERVAL=1/2/3 with various BYDAY sets.

Known limitation (documented on weekStart)

BYWEEKNO week numbering still uses ISO 8601 (Monday-based) weeks regardless of WKST — the WeekInfo algorithm is unchanged. This matches rrule.js's level of WKST support.

Full test suite passes (507 tests).

Restore WKST support that was previously removed (the golden tests were
left commented out with a "re-add when we support WKST again" TODO):

- iteration: use RecurrenceRule.actualWeekStart for the weekly date-set
  boundary (date_set.dart) and the weekly interval snap-back
  (frequency_interval.dart) instead of hardcoded Monday
- decoder: accept any WKST weekday and actually pass the parsed value to
  the RecurrenceRule constructor (it was previously dropped)
- model: relax the Monday-only constructor assert; include weekStart in
  ==/hashCode; add weekStart/clearWeekStart to copyWith
- re-enable the commented RFC 5545 WKST tests, including the canonical
  "days generated makes a difference because of WKST" pair; fix a typo
  in the previously commented golden (RFC lists February 3,17 - not 18)
- add dateutil-derived WKST goldens, codec round-trip, equality, and
  copyWith tests

Limitation (documented on RecurrenceRule.weekStart): BYWEEKNO week
numbering still uses ISO 8601 (Monday-based) weeks regardless of WKST,
matching rrule.js behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 18, 2026 23:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR restores and extends WKST (week start) support for weekly recurrence rules across parsing, iteration, and the RecurrenceRule model, and re-enables/expands the previously commented-out golden tests.

Changes:

  • Use actualWeekStart for weekly bucketing and weekly interval “snap-back” logic.
  • Decode and persist WKST for any weekday; relax model validation and include weekStart in equality/hashCode and copyWith.
  • Re-enable and add WKST-focused goldens and round-trip/equality/copyWith tests.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/rrule_ical_test.dart Re-enables RFC 5545 WKST goldens and updates expected outputs and test data structures.
test/recurrence_rule_test.dart Adds WKST-specific unit tests (goldens, round-trips, equality/hashCode, copyWith).
lib/src/recurrence_rule.dart Updates WKST validation/docs; adds weekStart to equality/hashCode and copyWith.
lib/src/iteration/frequency_interval.dart Applies actualWeekStart when computing weekly interval advancement.
lib/src/iteration/date_set.dart Applies actualWeekStart when building weekly date-set boundaries.
lib/src/codecs/string/decoder.dart Accepts and passes through any valid WKST weekday instead of rejecting non-Monday values.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 237 to 255
@override
int get hashCode {
return Object.hash(
frequency,
until,
count,
interval,
bySeconds,
byMinutes,
byHours,
byWeekDays,
byMonthDays,
byYearDays,
byWeeks,
byMonths,
bySetPositions,
weekStart,
);
}
@aaazlkm aaazlkm closed this Jul 18, 2026
@aaazlkm
aaazlkm deleted the feature/weekly-wkst branch July 18, 2026 23:44
@aaazlkm aaazlkm changed the title Support WKST (week start) for weekly frequencies Opened by mistake, please ignore Jul 18, 2026
@aaazlkm
aaazlkm restored the feature/weekly-wkst branch July 19, 2026 00:46
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.

2 participants