diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-10-16 22:23:13 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-10-16 23:28:34 +0200 |
commit | a22e8c4d85c5b0258545771f34c197f8dc1ad2f4 (patch) | |
tree | ab791368db1af9f6623005121fb09452a4f5c69d /module/vcomponent/validate.scm | |
parent | Fix errors when submitting events. (diff) | |
download | calp-a22e8c4d85c5b0258545771f34c197f8dc1ad2f4.tar.gz calp-a22e8c4d85c5b0258545771f34c197f8dc1ad2f4.tar.xz |
Validate that submitted event doesn't have invalid interval.
Diffstat (limited to '')
-rw-r--r-- | module/vcomponent/validate.scm | 16 |
1 files changed, 16 insertions, 0 deletions
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))) + ) |