Giter VIP home page Giter VIP logo

Comments (2)

c-trimm avatar c-trimm commented on July 17, 2024

The rule every 10th day of the month every 2 months will not work.

"every 2 months" is an interval and it matches on dates that are 2 months from the start date; in your instance, whatever today's date is. So, if I ran it today, it would match on the 18 of every 2 months.

"every 10th day of month" is a calendar rule and will only match dates on the 10th day of the month.

Therefore, when you run that code, it tries to match dates that are the 18th and 2 months from the start date, as well as the 10th of the month. Of course, that's impossible, and since "next" will continue running until it finds 5 dates, it loops forever.

from moment-recur.

semaja2 avatar semaja2 commented on July 17, 2024

Is there anyway to make it have a reoccuring moment that is say every Tuesday, every second week?

moment().recur().('Tuesday').daysOfWeek().every(2).weeks()

The above won't work because of the issue of above mentioned issue, but is there any way around this?

Edit:
Managed to find a work around by using two calendar intervals, and creating an array of weeks to match on

var weeks = Array.apply(null, {length: 52 + 1}).map(Number.call, Number).slice(1).filter(function(value, index, Arr) { return index % task.RecurPeriodicity == 0; }); recurringMoment = recurringTask.every(days).daysOfWeek().every(weeks).weeksOfYear();

from moment-recur.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.