Skip to content

Limit HOURLY/MINUTELY/SECONDLY by BYHOUR, BYMINUTE and BYSECOND - #77

Open
bardrop wants to merge 1 commit into
square:masterfrom
bardrop-oss:fix-sub-daily-by-time-filters
Open

bardrop wants to merge 1 commit into
square:masterfrom
bardrop-oss:fix-sub-daily-by-time-filters

Conversation

@bardrop

@bardrop bardrop commented Nov 21, 2026

Copy link
Copy Markdown

Fixes #76.

Hourly, Minutely and Secondly replace the timeset's hour/minute/second with the current date's, so BYHOUR (and BYMINUTE / BYSECOND where they limit) did nothing: FREQ=HOURLY;BYHOUR=9,17 returned every hour.

RFC 5545 says these parts limit sub-daily frequencies. Now possible_days returns no day for a period whose hour/minute/second is not in the list. BYMINUTE/BYSECOND still expand for HOURLY (and BYSECOND for MINUTELY) as before.

Tests: three specs in rule_spec.rb (HOURLY + BYHOUR, MINUTELY + BYHOUR/BYMINUTE, SECONDLY + all three). They fail before; all 255 pass after, rubocop clean.

I also compared 400 random HOURLY/MINUTELY/SECONDLY rules with BYHOUR/BYMINUTE/BYSECOND/BYDAY against python-dateutil: 296 differed before, none after (a few SECONDLY rules that span days are slow, as before).

HOURLY, MINUTELY and SECONDLY overwrote the timeset with the current
hour/minute/second, so BYHOUR (and BYMINUTE/BYSECOND where they apply)
had no effect. Per RFC 5545 these parts limit sub-daily frequencies, so
skip periods whose time is not in the list.

Fixes square#76
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.

BYHOUR/BYMINUTE/BYSECOND ignored for HOURLY, MINUTELY and SECONDLY

1 participant