Answer the question
In order to leave comments, you need to log in
Calculating the frequency of events in a calendar
Hello!
Please tell me if there are js libraries that allow solving such problems:
there is an event that starts for example on 01/03/2011,
it repeats every week on Tuesday/Wednesday/Saturday
, you need to get a set of dates when this event occurs during the time period from 02/01/20011 to 02/29/2011 (inclusive)
Or maybe there is a description of algorithms that allow you to work with recurring events. I think this problem has been solved many times. Unfortunately could not be found.
We need a functionality for managing the frequency of events, similar to the one that is, for example, in google or Yandex calendars.
Thank you.
Answer the question
In order to leave comments, you need to log in
Actually, the whole task comes down to determining the day of the week by date and passing through the interval FROM and TO. This is a rather trivial task.
The most convenient way is probably to make certain intervals, and for each make a separate function that returns the following date:
getNextWorkDay(date), getNextWeekDay(date), getNextFirstDayOfMonth(date), etc.
+ Simple tasks are much simpler than universal ones
+ It will be faster than a universal task
+ It is easier to maintain
- All gaps will need to be described separately
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question