Rrule generates wrong timeslots when setting specific days and hours in a time range

24 Views Asked by At

I want to get recurring events using Rrule that occurs let's say every Sunday from 3 July until 17 July from 8:00 until 15:00 and lasts 7 hours. So I want the following result: 9 July 08:00 - 15:00 16 July 08:00 - 15:00

How can I achieve this?

I tried the following rule for achieving that:

new RRule({
  freq: RRule.HOURLY,
  dtstart: new Date(Date.UTC(2023, 6, 3, 8, 0, 0)),
  until: new Date(Date.UTC(2023, 6, 17, 15, 0, 0)),
  interval: 7,
  wkst: RRule.SU,
  byweekday: RRule.SU
})

rule.toString():    

DTSTART:20230703T080000Z
RRULE:FREQ=HOURLY;UNTIL=20230717T150000Z;INTERVAL=7;WKST=SU;BYDAY=SU

and I got the following:

1 Sun, 09 Jul 2023 04:00:00 GMT 2 Sun, 09 Jul 2023 11:00:00 GMT 3 Sun, 09 Jul 2023 18:00:00 GMT 4 Sun, 16 Jul 2023 04:00:00 GMT 5 Sun, 16 Jul 2023 11:00:00 GMT 6 Sun, 16 Jul 2023 18:00:00 GMT

which is not what I want.

0

There are 0 best solutions below