pbogut / recurring_events

Elixir library for dealing with recurring events
MIT License
26 stars 8 forks source link

Exclude and count/take rules #10

Closed pinx closed 2 years ago

pinx commented 6 years ago

I wrote this little test:

  test "Test daily frequency with exclude date range" do
    result =
      ~N[2018-01-01 00:00:00]
      |> RR.unfold(%{
        freq: :daily,
        exclude_date: Date.range(~D[2018-01-02], ~D[2018-01-04])
      })

    expect =
      date_expand([
        {{2018, 1, 1}, {0, 0, 0}},
        {{2018, 1, 5}, {0, 0, 0}}
      ])

    assert expect == result |> Enum.take(5)
  end

The test fails, because I am getting 5 dates. I'll work on adding the feature of handling date ranges.

pbogut commented 6 years ago

But you should get 5 dates, whats wrong with that? Result should be 1st, 5th, 6th, 7th, 8th of Jan 2018, unless I'm missing something?