Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid byweekday conversion to string when initializing rrule with WeekdayStr ("MO", "TU") format #648

Open
vedranbasic opened this issue Feb 18, 2025 · 0 comments

Comments

@vedranbasic
Copy link

vedranbasic commented Feb 18, 2025

Example:

const testRrule = new RRule({
                    "freq": 1,
                    "count": 20,
                    "bymonth": [3, 4, 5, 6],
                    "dtstart": new Date("2025-02-17T23:00:00.000Z"),
                    "interval": 1,
                    "byweekday": ["MO", "TU", "WE"]
                })


testRrule.options

/**
You get:
{
   ...,
   "byweekday":[0,1,2,],
   ...
}
*/

testRrule.toString()

/**
You get:
'DTSTART:20250217T230000Z\nRRULE:FREQ=MONTHLY;COUNT=20;BYMONTH=3,4,5,6;INTERVAL=1;BYDAY=undefined,undefined,undefined'
*/

I presume if options are proper after initializing rrule object with WeekdayStr (2 character strings) and converted to number, then toString() method might not be implemented properly for byweekday conversion to BYDAY.

If I initialized rrule.byweekday with numbers, it'll return allright in both cases. Example:

const testRrule = new RRule({
                    "freq": 1,
                    "count": 20,
                    "bymonth": [3, 4, 5, 6],
                    "dtstart": new Date("2025-02-17T23:00:00.000Z"),
                    "interval": 1,
                    "byweekday": [0,1,2]
                })

testRrule.options

/** 
You get:
{
   ...,
   "byweekday":[0,1,2,],
   ...
}
*/

testRrule.toString()

/**
You get:
'DTSTART:20250217T230000Z\nRRULE:FREQ=MONTHLY;COUNT=20;BYMONTH=3,4,5,6;INTERVAL=1;BYDAY=BYDAY=MO,TU,WE'
*/

@vedranbasic vedranbasic changed the title Invalid byweekday conversion to string when given in string ("MO", "TU") format Invalid byweekday conversion to string when initializing rrule with WeekdayStr ("MO", "TU") format Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant