Skip to content

Yearly rules not completing #35

Description

@sarge

Hello, firstly thanks for the library! Elixir is missing a complete implementation.

I wish to help improve the rrule coverage. In testing a range of icalendar rules I have found a few gaps that I wish to help with. I am by no means a RRULE expert it has an extremely broad set rules.

These will be known to you, BYSETPOS BYMONTHDAY etc.

This is intended to capture an RRULE like FREQ=YEARLY;BYDAY=5MO

   test "yearly with days" do
      rule = Rule.new(:yearly, days: [{5, :monday}])
      |> IO.inspect(label: "state")
        |> Rule.init(~U[2025-02-01 07:00:00Z])
      assert rule.state.next == ~N[2025-02-03T07:00:00]

      rule = Rule.next(rule)
      assert rule.state.next == ~N[2026-02-02T07:00:00]

      rule = Rule.next(rule)
      assert rule.state.next == ~N[2027-02-01T07:00:00]
    end

In my investigation my thoughts are that the frequency needs to be passed down into the days.ex validation, I also suspect all of the BY... rules might need to be added to the days.ex? What are your thoughts on this? It might be a significant refactor.

Let me know if you open to PRs to support these features.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions