Skip to content

fix: preserve user-specified order for BYHOUR/BYMINUTE with BYSETPOS#69

Open
hatsumihayashi wants to merge 2 commits into
teambition:masterfrom
hatsumihayashi:master
Open

fix: preserve user-specified order for BYHOUR/BYMINUTE with BYSETPOS#69
hatsumihayashi wants to merge 2 commits into
teambition:masterfrom
hatsumihayashi:master

Conversation

@hatsumihayashi
Copy link
Copy Markdown

@hatsumihayashi hatsumihayashi commented Jan 20, 2026

Problem

When using BYSETPOS with BYHOUR and BYMINUTE, the library produces incorrect results.

Example

With this RRULE:

FREQ=DAILY;BYHOUR=3,6;BYMINUTE=45,15;BYSETPOS=1,4

Expected: 03:45, 06:15 (1st and 4th occurrences)

Actual: 03:15, 06:45

Cause

The library sorts BYHOUR and BYMINUTE values internally before generating the timeset, which changes the order of occurrences and causes BYSETPOS to select wrong positions.

Reference

スクリーンショット 2026-01-20 10 18 18

Solution

Remove the unnecessary sorting of BYHOUR/BYMINUTE values to preserve the original order when applying BYSETPOS.

hatsumihayashi and others added 2 commits March 21, 2025 11:09
Add tests to verify that BYSETPOS correctly references positions in the
timeset when BYHOUR and BYMINUTE values are specified in non-chronological
order.

These tests ensure the fix in commit 82c9f20 (remove sort for timeset)
works correctly and prevents regression.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@hatsumihayashi hatsumihayashi marked this pull request as ready for review January 20, 2026 01:15
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.

1 participant