lib/rrule.js
function bymonth(rules, dt) {
    if(!rules || !rules.length) return dt;

    var candidates = rules.map(function(rule) {
        var delta = rule-m(dt);
        if(delta < 0) delta += 12;

        var newdt = add_m(new Date(dt), delta);
        set_d(newdt, 1);
        return newdt;
    });

    var newdt = sort_dates(candidates).shift();
    return newdt || dt;
}
function bymonth(rules, dt) {
    if(!rules || !rules.length) return dt;

    var candidates = rules.map(function(rule) {
        var delta = rule-m(dt);
        if(delta < 0) delta += 12;

        var newdt = add_m(new Date(dt), delta);
        set_d(newdt, 1);
        return newdt;
    });

    var newdt = sort_dates(candidates).shift();
    return newdt || dt;
}
function bymonth ( rules , dt ) { if ( ! rules || ! rules . length ) return dt ; var candidates = rules . map ( function ( rule ) { var delta = rule - m ( dt ) ; if ( delta < 0 ) delta += 12 ; var newdt = add_m ( new Date ( dt ) , delta ) ; set_d ( newdt , 1 ) ; return newdt ; } ) ; var newdt = sort_dates ( candidates ) . shift ( ) ; return newdt || dt ; }
Advance to the next month that satisfies the rule...
Advance to the next month that satisfies the rule ...