montrose icon indicating copy to clipboard operation
montrose copied to clipboard

.every(:week, interval: 2) does not interact with on as expected

Open JonPugsley opened this issue 3 years ago • 2 comments

I've been tinkering with this library and like what I see, though I've either found a bug or don't quite understand the options.

Pattern:

Montrose.every(:week, interval: 2).on(["sunday", "monday"]).between(("2021-05-02".to_time)..("2021-05-22".to_time)).events.to_a

Events:

[2021-05-02, 2021-05-10, 2021-05-16]

The matching dates are the sunday of one week, then the monday of the next week, then the sunday of the week after that image

I would expect the dates to be [2021-05-02, 2021-05-03, 2021-05-16, 2021-05-17] image

It seems like the library is running a Monday-Sunday week with no option to change this (though Sunday seems to have a day number of 0, which implies a Sunday-Monday week)

JonPugsley avatar May 11 '21 18:05 JonPugsley

Hey @JonPugsley - I just tried that same command into my console, and the results were what you mentioned expecting:

Montrose.every(:week, interval: 2).on(["sunday", "monday"]).between(("2021-05-02".to_time)..("2021-05-22".to_time)).events.to_a

image

Are you using the most recent version of the gem?

thewatts avatar Aug 19 '21 16:08 thewatts

Screen Shot 2022-04-19 at 15 06 16 @thewatts I have the same behavior

mikalai-yankouski avatar Apr 19 '22 10:04 mikalai-yankouski

Hi @thewatts I also get the same output as @mikalai-yankouski and @JonPugsley ... Screen Shot 2022-10-20 at 12 53 34

the version is the montrose (0.13.0)

cavi21 avatar Oct 20 '22 10:10 cavi21