Implement SECONDLY and MINUTELY recurrence frequencies - #782
Open
gaoflow wants to merge 1 commit into
Open
Conversation
parseRRule() accepts FREQ=SECONDLY and FREQ=MINUTELY (both valid per RFC 5545 section 3.3.10, and listed in the class docblock), but next() had no case for either and no nextSecondly()/nextMinutely() existed, so currentDate never advanced. A bounded rule such as FREQ=MINUTELY;UNTIL=... looped forever, and a FREQ=MINUTELY;COUNT=4 rule returned four copies of the start. Add both, advancing by the interval and applying the BYHOUR/BYMINUTE limits (and BYSECOND for secondly), mirroring the do/while filtering already used by nextDaily(). The dateUpperLimit guard prevents an unsatisfiable BY combination from hanging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FREQ=SECONDLYandFREQ=MINUTELYare accepted byparseRRule()and listed in the class docblock, butnext()has no case for either and nonextSecondly()/nextMinutely()exists, socurrentDatenever advances. Two results on ordinary valid input:FREQ=MINUTELY;COUNT=4returns four copies of the start instead of minute-spaced instants.FREQ=MINUTELY;UNTIL=...loops forever —valid()stays true whilecurrentDatenever passesuntil. Same forSECONDLY.Both methods advance by the interval and apply the BYHOUR/BYMINUTE limits (plus BYSECOND for secondly), mirroring the
do/whilefilteringnextDaily()already uses; thedateUpperLimitguard stops an unsatisfiable BY combination from hanging.This covers the LIMIT rules for these two frequencies (RFC 5545 §3.3.10). The EXPAND cases are left as follow-up: BYSECOND under MINUTELY, and BYMINUTE/BYSECOND under HOURLY and coarser frequencies (which is why
FREQ=HOURLY;BYMINUTE=0,30still yields one instance per hour) — those need an expansion pass the iterator doesn't have yet.Tests cover COUNT- and UNTIL-bounded cases for both frequencies, INTERVAL, and the BYHOUR/BYMINUTE/BYSECOND limits; the UNTIL tests are capped so they can't hang.