Add offset to Date & Time Comparisons


#1

Title says it all really…
When selecting a Time virtual device, the comparison has an offset feature. It would be nice if the Date & Time option had this as well.


#2

Write an expression containing a date/time function:

https://wiki.webcore.co/Functions#Date_and_time_functions


#3

Ah, that’s much cleaner than doing the math by hand like I was, thanks!

Is there some particular reason I can’t think of for offsets to exist for one type and not the other?


#4

I guess people don’t have much need to offset days, can’t think what I would use that for??

I use hours / minutes offsets a lot, mainly relating to sunrise / sunset.

Would love to know your use case here?


#5

To answer your question (from the future!), my particular use case here is a holddown interval.
When a door opens, piston triggers a speaker to go ding, but its obnoxious for it to go ding more than once in 30s or so.

Using your pointer to the functions, I now use Date & Time is after {addMinutes(LastTrigger, HoldDownTime)}