mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-11-29 08:56:03 +00:00
Add a function to convert iCalendar interval syntax into SQL.
This commit is contained in:
1 parent
cee251d700
commit
bf2d2c3870
2 files changed
+11
No files matched your search
@@ -708,3 +708,9 @@ BEGIN
|
||||
|
||||
END;
|
||||
$$ LANGUAGE 'plpgsql' IMMUTABLE STRICT;
|
||||
|
||||
|
||||
CREATE or REPLACE FUNCTION icalendar_interval_to_SQL( TEXT ) RETURNS interval AS $function$
|
||||
SELECT CASE WHEN substring($1,1,1) = '-' THEN -1 ELSE 1 END * regexp_replace( regexp_replace($1, '[PT-]', '', 'g'), '([A-Z])', E'\\1 ', 'g')::interval;
|
||||
$function$ LANGUAGE 'SQL' IMMUTABLE STRICT;
|
||||
|
||||
Reference in new issue
Block a user