1 package PVE
::CalendarEvent
;
8 use PVE
::Tools
qw(trim);
9 use Proxmox
::RS
::CalendarEvent
;
11 # Note: This class implements a parser/utils for systemd like calendar exents
12 # Date specification is currently not implemented
24 PVE
::JSONSchema
::register_format
('pve-calendar-event', \
&pve_verify_calendar_event
);
25 sub pve_verify_calendar_event
{
26 my ($text, $noerr) = @_;
28 eval { parse_calendar_event
($text); };
30 return undef if $noerr;
31 die "invalid calendar event '$text' - $err\n";
37 # returns a $calspec hash which can be passed to compute_next_event()
38 sub parse_calendar_event
{
41 $event = trim
($event);
44 die "unable to parse calendar event - event is empty\n";
47 return Proxmox
::RS
::CalendarEvent-
>new($event);
50 sub compute_next_event
{
51 my ($calspec, $last) = @_;
53 return $calspec->compute_next_event($last);