Giter Club home page Giter Club logo

dayjs-recur's People

Contributors

dependabot[bot] avatar fraserhamilton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mlazuardy uhurun

dayjs-recur's Issues

Duplicated recurrence when date is end of month

Hi, first of all thank you for building this plugin - it's great.

I've found a bug, whenever I create recurring dates with monthly recurrence and the initial date is at the end of the month (30, 31) it duplicates a date.

Example:

// Create a date to start from (end of a month)
const myDate = dayjs("30/11/2022");

// Pass recurrence in months
const recurrence = myDate.recur().every(3, "months");

// Output
Feb 28, 2023 ✅
May 30, 2023 ✅
May 31, 2023 ❌

For some reason it duplicates a date every 2 months or so. Hope this helps to find a fix.

Unexpected values

Hi,
I’m willing to create a recurring date based on "nth weekday of month"
Here is my solution work when I select current Date

let dates = {};
 const currentDate = dayjs();
 const recurrence = currentDate
   .recur(dayjs().add(4, "month"))
   .every("Wednesday")
   .daysOfWeek()
   .every(currentDate.monthWeekByDay())
   .weeksOfMonthByDay();
 recurrence.all().forEach((date) => {
   dates[date.format("YYYY-MM-DD")] = { selected: true, };
 });
// dates = ["2022-09-21","2022-10-19","2022-11-16","2022-12-21","2023-01-18"]

but if put last day of this month which is 30 ,

 let dates = {};

  const lastDayofMonth = dayjs().endOf("month");
  const recurrence = lastDayofMonth
    .recur(dayjs().add(4, "month"))
    .every("Friday")
    .daysOfWeek()
    .every(lastDayofMonth.monthWeekByDay())
    .weeksOfMonthByDay();

I was expecting to get
["2022-09-30","2022-10-28","2022-11-25","2022-12-30"..]

but I got
["2022-09-30","2022-12-30"]

Here is demo

Am I missing something ?
Thanks in advance

is it still maintained?

Hello Guys,

I'm looking for an alternative to moment JS, I'm switching to DayJS and used to work with moment-recur which is a great library.

I found your repo doing some research and love what you did! I would like to know do you plan to maintain this plug-in?
Thank you.

Start date is not included in next()

` let nextDates;

// Create a recurrence
const recurrence = dayjs("01/01/2020").recur().every(2).days();

// Generate the next three dates as dayjs instances
// Outputs: [dayjs("01/03/2020"), dayjs("01/05/2020"), dayjs("01/07/2020")]
nextDates = recurrence.next(3); `

In the above code snippet, the start date 01/01/2020 is not included.

How to make recurrence like Saturday & Sunday every two weeks

Hi, I know this combine not working, but I need To.

ex)
// Monday&Thursday every 2 weeks.
const date = dayjs().recur('2022-11-15', 2023-12-15').every(["Monday","Thursday"]).daysOfWeek().every(2).weeks();
const dateAll = date.all();

but dateAll value was [].

Is there any way you could help me?

Support RRULE standard

It would be awesome if this plugin could support RRULE standard to be able to pass down the RRULE string and operate with the correspondent generated recurring events.

For example:

// Create a recurrence using today as the start date.
const recurrence = dayjs().recur("FREQ=DAILY;INTERVAL=2;COUNT=4");
// Or
const recurrence = dayjs().recur({
  freq: "DAILY",
  interval: 2,
  count: 4
});
// Outputs: ["2022-10-21T13:50:00.000Z", "2022-10-23T13:50:00.000Z", "2022-10-25T13:50:00.000Z", "2022-10-27T13:50:00.000Z"]
const allDates = recurrence.all();

Having issue on multiple week days

When we are passing date value as

recur = dayjs("2021-11-07 00:00:00").every([0,6]).daysOfWeek().every(2).weeks()
const nextDate = recur.next(1)[0];
expected next date = "2021-11-20 00:00:00"
received = "2021-11-21 00:00:00"

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.