Skip to content

fix: weekday 7-to-0 conversion corrupting ranges#580

Merged
merencia merged 1 commit into
mainfrom
fix/weekday-7-range-corruption
Jun 24, 2026
Merged

fix: weekday 7-to-0 conversion corrupting ranges#580
merencia merged 1 commit into
mainfrom
fix/weekday-7-range-corruption

Conversation

@merencia

@merencia merencia commented Jun 24, 2026

Copy link
Copy Markdown
Member

expression.replace('7', '0') ran before range expansion, so 5-7 became 5-0 and expanded to the wrong days.

Moved the 7-to-0 normalization to after range expansion, operating on the numeric array.

Expression Before After
5-7 [0,1,2,3,4,5] [5,6,0]
1-7 [0,1] [1,2,3,4,5,6,0]
6-7 [0,1,2,3,4,5,6] [6,0]
0-7 [0] [0,1,2,3,4,5,6]

The previous `expression.replace('7', '0')` ran as a plain string
replacement before range expansion, turning `5-7` (Fri-Sun) into `5-0`
which expanded to Sun-Fri (the opposite of what the user intended).

Move the 7-to-0 normalization to after range expansion and integer
parsing, operating on the numeric array instead of the raw string.
Also handles string tokens like `7L` (last Sunday) and deduplicates
when both 0 and 7 are present.
@merencia
merencia force-pushed the fix/weekday-7-range-corruption branch from 371b48a to 2928a41 Compare June 24, 2026 14:29
@merencia
merencia merged commit c8a3943 into main Jun 24, 2026
7 checks passed
@merencia
merencia deleted the fix/weekday-7-range-corruption branch June 24, 2026 17:19
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