Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matching 4th weekday of month when recurrence started with 5th weekday of month #36

Open
mikegleasonjr opened this issue Jul 22, 2015 · 2 comments

Comments

@mikegleasonjr
Copy link

In Google Calendar, when you start a recurrence with let's say the 5th monday of a month, on the next month if there is only 4 mondays it will match the last one. I would expect this library to do the same.

Here's a test case scenario:

moment({ date: 31, month: 2, year: 2014 }) // 5th monday of march 2014
    .recur()
    .every(1).daysOfWeek() // monday
    .every(4) // fifth monday
    .weeksOfMonthByDay()
    .matches(moment({ date: 31, month: 7, year: 2015 })) // aug 31st 2015, 5th monday
    // returns true
moment({ date: 31, month: 2, year: 2014 }) // 5th monday of march 2014
    .recur()
    .every(1).daysOfWeek() // monday
    .every(4).weeksOfMonthByDay() // fifth monday
    .matches(moment({ date: 24, month: 10, year: 2014 })) // nov 24th 2014, 4th monday
    // returns false

Thank you

@cesarizu
Copy link

cesarizu commented Jun 1, 2016

I created a PR that allows you to match against the last (or second to last, etc) week of the month by day that might help with this use-case. See: /pull/53

@niftylettuce
Copy link
Contributor

You should be able to use simple-recur as an alternative to this project (there are several core bugs described in #85). See https://github.com/jamiter/simple-recur.
I'm waiting on a PR to merge for better documentation for that repo at Swydo/simple-recur#3 -- so until that is resolved you can view better docs at https://github.com/niftylettuce/simple-recur/tree/patch-1#simple-recur in the meanwhile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants