Skip to content

Instantly share code, notes, and snippets.

@jalogisch
Created September 23, 2019 13:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jalogisch/72455fc830d6e0ab41f0c6aacb1c2bb9 to your computer and use it in GitHub Desktop.
Save jalogisch/72455fc830d6e0ab41f0c6aacb1c2bb9 to your computer and use it in GitHub Desktop.
outside working hours.
rule "off work hours"
when
( to_long(to_date($message.timestamp, "Asia/Manila").hourOfDay) >= 0 AND to_long(to_date($message.timestamp, "Asia/Manila").hourOfDay) <= 6 ) OR
( to_long(to_date($message.timestamp, "Asia/Manila").hourOfDay) >= 18 AND to_long(to_date($message.timestamp, "Asia/Manila").hourOfDay) <= 0 )
then
set_field("trigger_workhours_off", true);
end
rule "off work weekend"
when
// from Monday (1) to Sunday (7)
to_long(to_date($message.timestamp, "Asia/Manila").dayOfWeek) == 7 OR
to_long(to_date($message.timestamp, "Asia/Manila").dayOfWeek) == 6
then
set_field("trigger_workhours_off", true);
end
@HungryHowies
Copy link

@jan
I see my mistake now. Thank you sir, much apperciated.

@jan
Copy link

jan commented Sep 25, 2019

@HungryHowies wasn‘t me.

@HungryHowies
Copy link

HungryHowies commented Oct 9, 2019

@jan
Whom ever it was that did this I would Like to say thanks, it has been working exceptionally well. I did make some configuration to support my own needs, but was a great start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment