Required Expression - Between 2 dates Error

I selected required Expression, between 2 dates. Unfortunately I didn't realize that April 31st isn't valid and it errors out. Can't get past it.

Can reproduce. Tagging @bravenel to see if this can be better handled on the app side.

In the meantime, unless he has any better ideas, you can re-create the rule and remove this one via the App Status page for this rule (since you're no longer able to get in the normal pages).

At least it didn't error out for April 1. I wonder what happens if you do a cron string with Feb. 29. Does it only run every 4 years?

2 Likes

I made a required expression of "Between February 29 and February 29," and it's a bit...odd, but somewhat understandable as to how it got there:

Unexpectedly, that expression also evaluates to true (today is November 18, 2022, for anyone reading this in the future), as did lots of other conditions involving February 29, though I didn't try all combinations:

Not sure if this was a serious question, but it made me curious enough to try. :slight_smile:

This is correct. It IS between Feb 29 and Feb 29. The Scheduled Jobs reflect the next events that could affect that. Evidently the date methods are smart enough to change Feb 29 to Mar 1 instead of choking on it in non-Leap years.

Any Between Two Dates with the same date for both will always be true.

Here is the cron generator result:

Screenshot 2022-11-19 at 10.25.40 AM

I guess the 29th day of February is March 1st next year. Makes sense.

I thought putting the start and end date to the same date was a way to check whether it is a specific date, per this note in the UI:

and the fact that it works as expected with dates that aren't February 29:

"Between February 1 to February 29" was also true, which I guess makes sense if February 1 is this year and February 29 is the next occurrence (2024?). Never really thought through how this would work; I was just thinking of someone who might want some "date is in February, any year" condition. February 29 really seems to cause surprising results. I don't have any need for any particular behavior--just started playing around with possibilities after the question was posed. :smiley:

You're right, I'm wrong. Yeah, it became true probably due to the weirdness around Feb 29. I don't know the detail of why it says true for today, would have to dig to see what those underlying calendar methods are doing.

Download the Hubitat app