Skip to content

fix: DateRange invalid slice step computation when step != 1#15560

Merged
josevalim merged 1 commit into
elixir-lang:mainfrom
AlexGx:ag-date_range-fix
Jul 9, 2026
Merged

fix: DateRange invalid slice step computation when step != 1#15560
josevalim merged 1 commit into
elixir-lang:mainfrom
AlexGx:ag-date_range-fix

Conversation

@AlexGx

@AlexGx AlexGx commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Current behavior

Enum.slice(Date.range(~D[2001-01-01], ~D[2001-01-10], 2), 0..2//2)
#=> [~D[2001-01-01], ~D[2001-01-04]]

~D[2001-01-04] - is not at range at all

Expected

Enum.slice(Date.range(~D[2001-01-01], ~D[2001-01-10], 2), 0..2//2)
#=> [~D[2001-01-01], ~D[2001-01-05]]

Changes

  • fix slice step computation
  • tests updated

@josevalim josevalim merged commit ecf5517 into elixir-lang:main Jul 9, 2026
15 checks passed
@josevalim

Copy link
Copy Markdown
Member

💚 💙 💜 💛 ❤️

@AlexGx AlexGx deleted the ag-date_range-fix branch July 9, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants