REPOSITORY CODING · MEDIUM
Keep weekly recurrence intervals aligned to Monday weeks
Weekly rules are grouped from the start weekday and include dates from the wrong alternating week. Use the containing Monday as the week anchor, while preserving the start-date lower bound and BYDAY filtering.
Repository ImplementationDate recurrence calendar workbench
Work through a real codebase.
Choose an environment, investigate the existing implementation and use the tests to check your change. Sign in to open a workspace; execution and Ono usage follow your plan’s allowances.
Task requirements and environments
Angular · 55 minute session
- Expand a bounded date-only recurrence with DAILY, WEEKLY or MONTHLY frequency and interval 1–12. Dates are strict Gregorian YYYY-MM-DD values in 1900–2100 and calculations use UTC day numbers. The inclusive view range spans at most 3700 days. This deliberately bounded contract is not a complete RFC 5545 implementation.
- Daily intervals are start-relative. Weekly intervals use the Monday containing start, with BYDAY or the start weekday by default. Monthly intervals use the start month, with BYMONTHDAY or the start day by default. Positive invalid month days are skipped; negative positions count backwards from the actual month end.
- Rule candidates must satisfy filters and lie in the view range. COUNT, when supplied, limits that rule candidate sequence before exclusions; excluded candidates still consume COUNT. Explicit include dates do not consume COUNT. This contract does not unconditionally include a start date that fails its rule filters.
- The final dates are the sorted union of rule dates and explicit inclusions, clipped to the view range, with exclusions taking precedence. Deduplicate dates and validate every explicit date, including excluded and out-of-range ones. Requests remain unchanged.
JavaScript · 55 minute session
- Expand a bounded date-only recurrence with DAILY, WEEKLY or MONTHLY frequency and interval 1–12. Dates are strict Gregorian YYYY-MM-DD values in 1900–2100 and calculations use UTC day numbers. The inclusive view range spans at most 3700 days. This deliberately bounded contract is not a complete RFC 5545 implementation.
- Daily intervals are start-relative. Weekly intervals use the Monday containing start, with BYDAY or the start weekday by default. Monthly intervals use the start month, with BYMONTHDAY or the start day by default. Positive invalid month days are skipped; negative positions count backwards from the actual month end.
- Rule candidates must satisfy filters and lie in the view range. COUNT, when supplied, limits that rule candidate sequence before exclusions; excluded candidates still consume COUNT. Explicit include dates do not consume COUNT. This contract does not unconditionally include a start date that fails its rule filters.
- The final dates are the sorted union of rule dates and explicit inclusions, clipped to the view range, with exclusions taking precedence. Deduplicate dates and validate every explicit date, including excluded and out-of-range ones. Requests remain unchanged.