diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-10-28 23:38:46 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-11-06 00:46:26 +0100 |
commit | 523df154032a720d1c0cda298e02a45a01b74822 (patch) | |
tree | 75c513e5845619aff8827ae44faffc788fa7ad38 /module/vcomponent/util/instance | |
parent | Add tests for '(hnh test util)'. (diff) | |
download | calp-523df154032a720d1c0cda298e02a45a01b74822.tar.gz calp-523df154032a720d1c0cda298e02a45a01b74822.tar.xz |
Move 'validate-event' into only module using it.
Diffstat (limited to 'module/vcomponent/util/instance')
-rw-r--r-- | module/vcomponent/util/instance/methods.scm | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/module/vcomponent/util/instance/methods.scm b/module/vcomponent/util/instance/methods.scm index fef83958..3c531c67 100644 --- a/module/vcomponent/util/instance/methods.scm +++ b/module/vcomponent/util/instance/methods.scm @@ -14,6 +14,8 @@ :use-module (oop goops) :use-module (calp translation) + :use-module ((hnh util exceptions) + :select (warning)) :export (load-calendars @@ -173,9 +175,19 @@ +(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))) + ) + + (define-method (add-and-save-event (this <events>) calendar event) - ((@ (vcomponent validate) validate-event) event) + (validate-event event) (cond [(get-event-by-uid this (prop event 'UID)) |