I try to make an rrule instance and then set the start date/time (dtstart) but the events get the wrong time.
RRULE:FREQ=WEEKLY;INTERVAL=1;WKST=MO;COUNT=20rrule.options like so:
rrule.options.dtstart = new Date(Date.UTC(2019, 1, 4, 12, 30, 0))rrule.all() to see the generated events. All events now have the current time instead of the time set via dtstart. It should show 12:30 insteadI made this sandbox demonstrating the problem.
Now, when I do exactly the same in rrule.js demo page, I get correct results.
On this demo page, do the following to see what I mean:

These are the results:

As you can see, time of the events is set correctly!
Any advice appreciated!
Found the answer:
If you set distart explicitly in the constructor, then the problem is solved.
Compare these examples:
Example one: gives correct results:
const rrule = new RRule({
freq: RRule.WEEKLY,
interval: 1,
wkst: RRule.MO,
count: 20,
dtstart: new Date(Date.UTC(2019, 1, 4, 12, 30, 0))})
Example two: gives wrong results
const rrule = new RRule({
freq: RRule.WEEKLY,
interval: 1,
wkst: RRule.MO,
count: 20})
rrule.options.dtstart = new Date(Date.UTC(2019, 1, 4, 14, 30, 0));
To me, this looks a bit counter intuitive because setting dtstart should always give the same result whether you set it in the constructor or set it afterwards.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With