Skip to content

Recurrance that Skips Periods #26

Open
@eric1234

Description

@eric1234

I don't understand how to do something like "every other monday". If I just put that in tickle I get an error:

> Tickle.parse('every other monday')
wrong number of arguments (given 1, expected 3) (ArgumentError)

This seems due to this call that only passes a single argument even though chronic_parse takes 3.

But I'm assuming maybe I'm just not hitting a supported expression. Let's try "every other week starting monday":

> Tickle.parse('every other week starting monday')
=> {:next=>2024-12-30 12:00:00 -0500, :expression=>"other week", :starting=>2024-12-30 12:00:00 -0500, :until=>nil}

K, that looks promising. But once we get to 12/31 how do we get the next date. If I just call it again I will get back 1/6 as it doesn't really have info about my orig start date. For all it knows this is the first time I'm asking and 1/6 is the first instance.

The obvious solution seems to pass start so it knows a reference from when to count from but that seems to do nothing. Same result with or without:

> Tickle.parse('every other week starting monday', start: Date.new(2024, 12, 3))
=> {:next=>2024-12-30 12:00:00 -0500, :expression=>"other week", :starting=>2024-12-30 12:00:00 -0500, :until=>nil}
> Tickle.parse('every other week starting monday')
=> {:next=>2024-12-30 12:00:00 -0500, :expression=>"other week", :starting=>2024-12-30 12:00:00 -0500, :until=>nil}

Given a start date of the 3rd I would expect Jan 6th to be the next date from today that is every other monday but instead it returns Dec 30th. Also the README seems to indicate the start date has a different purpose. More to indicate at what point in the future should the repeating start (rather than just assume today?)

I tried looking at the tests to see how to get more than one date with this sort of skipping but the tests don't seem to do that. I imagine this same sort of issue occurs not just with every other week but anything like "every other day", "every other month", "every 4th day", etc.

Am I missing something obvious?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions