Skip to content

Fix wrap-around month logic in calendar_tostringlist#92

Merged
emericg merged 1 commit into
emericg:masterfrom
bterrier:calendar_tostringlist
May 25, 2026
Merged

Fix wrap-around month logic in calendar_tostringlist#92
emericg merged 1 commit into
emericg:masterfrom
bterrier:calendar_tostringlist

Conversation

@bterrier

Copy link
Copy Markdown
Contributor

For year-wrapping calendar intervals like "12-2" (Dec-Feb), the else
branch matched months 2-12 instead of {12, 1, 2} -- the complement of
the intended set. Plants with winter blooming/fruiting periods (e.g.
Coffea arabica fruiting 12-2, Cymbidium cochleare blooming 12-1)
displayed the wrong months in their calendar widget.

Use OR instead of AND so the wrap-around branch covers months >= first
or <= second.

For year-wrapping calendar intervals like "12-2" (Dec-Feb), the else
branch matched months 2-12 instead of {12, 1, 2} -- the complement of
the intended set. Plants with winter blooming/fruiting periods (e.g.
Coffea arabica fruiting 12-2, Cymbidium cochleare blooming 12-1)
displayed the wrong months in their calendar widget.

Use OR instead of AND so the wrap-around branch covers months >= first
or <= second.
@emericg

emericg commented May 25, 2026

Copy link
Copy Markdown
Owner

Yes that was wrong...
The plant database code is definitely not the most tested code (or even just used), so big thanks for having a look around :)

@emericg emericg merged commit 237efb5 into emericg:master May 25, 2026
4 of 5 checks passed
@bterrier bterrier deleted the calendar_tostringlist branch May 25, 2026 19:33
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