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

Does it support nth day rule??? #10

Open
adityaawl opened this issue May 12, 2020 · 6 comments
Open

Does it support nth day rule??? #10

adityaawl opened this issue May 12, 2020 · 6 comments

Comments

@adityaawl
Copy link

Executing occurrences on rrule RRULE:FREQ=MONTHLY;COUNT=3;INTERVAL=1;BYDAY=1TU
returns the error. Seems like it doesn't understand nth day. I'm not sure if I'm missing anything.

SQL Error [22P02]: ERROR: invalid input value for enum _rrule.day: "1TU"
Where: SQL function "day_array" statement 1
SQL statement "WITH "tokens" AS (
WITH A20 as (SELECT _rrule.parse_line($1::text, 'RRULE') "r"),
-- Split each key value pair into an array, e.g. {'FREQ', 'DAILY'}
A30 as (SELECT regexp_split_to_array("r", '=') AS "y" FROM A20)
SELECT "y"[1] AS "key", "y"[2] AS "val" FROM A30
),
candidate AS (
SELECT
(SELECT "val"::_rrule.FREQ FROM "tokens" WHERE "key" = 'FREQ') AS "freq",
(SELECT "val"::INTEGER FROM "tokens" WHERE "key" = 'INTERVAL') AS "interval",
(SELECT "val"::INTEGER FROM "tokens" WHERE "key" = 'COUNT') AS "count",
(SELECT "val"::TIMESTAMP FROM "tokens" WHERE "key" = 'UNTIL') AS "until",
(SELECT _rrule.integer_array("val") FROM "tokens" WHERE "key" = 'BYSECOND') AS "bysecond",
(SELECT _rrule.integer_array("val") FROM "tokens" WHERE "key" = 'BYMINUTE') AS "byminute",
(SELECT _rrule.integer_array("val") FROM "tokens" WHERE "key" = 'BYHOUR') AS "byhour",
(SELECT _rrule.day_array("val") FROM "tokens" WHERE "key" = 'BYDAY') AS "byday",
(SELECT _rrule.integer_array("val") FROM "tokens" WHERE "key" = 'BYMONTHDAY') AS "bymonthday",
(SELECT _rrule.integer_array("val") FROM "tokens" WHERE "key" = 'BYYEARDAY') AS "byyearday",
(SELECT _rrule.integer_array("val") FROM "tokens" WHERE "key" = 'BYWEEKNO') AS "byweekno",
(SELECT _rrule.integer_array("val") FROM "tokens" WHERE "key" = 'BYMONTH') AS "bymonth",
(SELECT _rrule.integer_array("val") FROM "tokens" WHERE "key" = 'BYSETPOS') AS "bysetpos",
(SELECT "val"::_rrule.DAY FROM "tokens" WHERE "key" = 'WKST') AS "wkst"

@volkanunsal
Copy link
Owner

Nth day rule is not implemented.

@antoinerl
Copy link

Hi,
@volkanunsal Do you think you would implement it ?

@adityaawl did you find a solution to get nth days ? Did you implement something ?

Thank you for your work

@reysy
Copy link

reysy commented Dec 7, 2022

Hi,
@volkanunsal do you think you would implement it?

Thank you.

@volkanunsal
Copy link
Owner

Hey @reysy . I have no immediate plans to implement this feature unfortunately.

@reysy
Copy link

reysy commented Dec 8, 2022

@volkanunsal Hi, thank you for your work and the reply!

@PeterSR
Copy link

PeterSR commented Jul 31, 2024

@adityaawl - Isn't the RRULE string supposed to be

RRULE:FREQ=MONTHLY;COUNT=3;INTERVAL=1;BYSETPOS=1;BYDAY=TU

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

5 participants