fraserhamilton / dayjs-recur Goto Github PK
View Code? Open in Web Editor NEWDay.js plugin for matching and generating recurring dates.
Home Page: https://www.npmjs.com/package/dayjs-recur
License: MIT License
Day.js plugin for matching and generating recurring dates.
Home Page: https://www.npmjs.com/package/dayjs-recur
License: MIT License
Seems like the save
method is just missing from the type definition.
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.
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
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.
` 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.
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?
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();
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"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.