Well, after looking at my rule I realized I was doing things a little wrong
My original line was as follows
val openTime = new DateTimeType(LastBoxOpen.state.toString)
according to Rud’s great time conversion thread, what I seem to be doing here is taking a OpenHAB item (a DateTimeType) and converting it to a string to then create another OpenHAB DateTimeType from it??? Obviously stupid (as Scott pointed out)
So new version (just remove the Type from DateTimeType)
val openTime = new DateTime(LastBoxOpen.state.toString)
Converts OH item (DateTimeType) to a string and then from the string creates a Joda time which works with isBefore just fine. I’ll have to look at my old thread but I’m amazed my old version worked at all.
Is this still as you say Scott, unintended behavior? Is there a cleaner way of comparing OH DateTimeTypes or converting them to Joda?
Edit to add: This is really kind of crazy… When I convert the rule to use millis, I changed the comparison line to this because millis is just a number
if (openTime < motionTime) {tally = (tally + 60)}
And when I just now tested it with the Joda time… the above still worked???
No isBefore needed???