volkanunsal / postgres-rrule

Recurring dates in Postgres.
MIT License
106 stars 26 forks source link

Does not repeat within the defined tsrange #4

Open gajus opened 4 years ago

gajus commented 4 years ago
select *
FROM
  occurrences('
    DTSTART:20200301T000000
    RRULE:FREQ=WEEKLY'::TEXT::rruleset, tsrange('2020-03-01 00:00', '2021-04-01 00:00'));

Produces:

"occurrences"
"2020-03-01 00:00:00"
"2020-03-08 00:00:00"

I expect to get 57 rows (as there are 57 weeks in the time range), but I am only getting 2 rows.

Adding an arbitrary large COUNT "fixes" the problem.

select *
FROM
  occurrences('
    DTSTART:20200301T000000
    RRULE:FREQ=WEEKLY;COUNT=1000'::TEXT::rruleset, tsrange('2020-03-01 00:00', '2021-04-01 00:00'));

Produces:

"occurrences"
"2020-03-01 00:00:00"
"2020-03-08 00:00:00"
"2020-03-15 00:00:00"
"2020-03-22 00:00:00"
"2020-03-29 00:00:00"
"2020-04-05 00:00:00"
"2020-04-12 00:00:00"
"2020-04-19 00:00:00"
"2020-04-26 00:00:00"
"2020-05-03 00:00:00"
"2020-05-10 00:00:00"
"2020-05-17 00:00:00"
"2020-05-24 00:00:00"
"2020-05-31 00:00:00"
"2020-06-07 00:00:00"
"2020-06-14 00:00:00"
"2020-06-21 00:00:00"
"2020-06-28 00:00:00"
"2020-07-05 00:00:00"
"2020-07-12 00:00:00"
"2020-07-19 00:00:00"
"2020-07-26 00:00:00"
"2020-08-02 00:00:00"
"2020-08-09 00:00:00"
"2020-08-16 00:00:00"
"2020-08-23 00:00:00"
"2020-08-30 00:00:00"
"2020-09-06 00:00:00"
"2020-09-13 00:00:00"
"2020-09-20 00:00:00"
"2020-09-27 00:00:00"
"2020-10-04 00:00:00"
"2020-10-11 00:00:00"
"2020-10-18 00:00:00"
"2020-10-25 00:00:00"
"2020-11-01 00:00:00"
"2020-11-08 00:00:00"
"2020-11-15 00:00:00"
"2020-11-22 00:00:00"
"2020-11-29 00:00:00"
"2020-12-06 00:00:00"
"2020-12-13 00:00:00"
"2020-12-20 00:00:00"
"2020-12-27 00:00:00"
"2021-01-03 00:00:00"
"2021-01-10 00:00:00"
"2021-01-17 00:00:00"
"2021-01-24 00:00:00"
"2021-01-31 00:00:00"
"2021-02-07 00:00:00"
"2021-02-14 00:00:00"
"2021-02-21 00:00:00"
"2021-02-28 00:00:00"
"2021-03-07 00:00:00"
"2021-03-14 00:00:00"
"2021-03-21 00:00:00"
"2021-03-28 00:00:00"
treystout commented 4 years ago

same here. We almost only create weekly events in our app so I set the count to 50,000 for "infinite" series.