From a22e8c4d85c5b0258545771f34c197f8dc1ad2f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 16 Oct 2022 22:23:13 +0200 Subject: Validate that submitted event doesn't have invalid interval. --- module/vcomponent/validate.scm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 module/vcomponent/validate.scm (limited to 'module/vcomponent/validate.scm') diff --git a/module/vcomponent/validate.scm b/module/vcomponent/validate.scm new file mode 100644 index 00000000..8881c95f --- /dev/null +++ b/module/vcomponent/validate.scm @@ -0,0 +1,16 @@ +(define-module (vcomponent validate) + :use-module (vcomponent) + :use-module (datetime) + :use-module ((hnh util exceptions) + :select (warning)) + :use-module (calp translation) + :export (validate-event)) + +(define (validate-event component) + (unless (date/-time<= + (prop component 'DTSTART) + (prop component 'DTEND)) + (warning (G_ "end (~a) must be equal to or greater than start (~a)") + (prop component 'DTEND) + (prop component 'DTSTART))) + ) -- cgit v1.2.3