Issue with time comparing rule

Guys I need some help with this rule for my watering system.

  rule "Rain Delay"
    Time cron "5 35 14 ? * * *" //23:15:05
    if (ProgramA_Master_Weather.lastUpdate.before(now.minusDays(maxOffDays))) {
      //  if(ProgramA_Master_Weather.lastUpdate.time < now.minusDays(maxOffDays.millis)) {
    else {
        var boolean delay = false
        //Es hat heute geregnet min. 4mm
        if ((RainToday.state as QuantityType<Number>).doubleValue >= minPrecip) {
             delay = true
        //Regen im Forecast min. 50%
        if ((ForecastProbaPrecip_day1.state as QuantityType<Number>).doubleValue >= minPrecipPercent) {
             delay = true
        if (delay) {
            logInfo(filename,"Beregnung: Es hat geregnet oder Regen im Forecast")
            sendPushoverMessage(pushoverBuilder("Es hat geregnet heute geregnet oder die Regenwahrscheinlichkeit für morgen liegt über 50%. Die beregnung wird für 2 tage deaktiviert"))
        else {

I get the following error.

[ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'Rain Delay': 'before' is not a member of 'org.joda.time.base.AbstractInstant'; line 49, column 9, length 68

I know it has to do with joda time, but how can I solve it.
Any Ideas? There are some hints in some topics, but I could not solve it.

Thank you in advance.

Hints here. openHAB Item datetime are not the same as joda datetime, so you must do some kind of conversion to compare.

thanks, yes. But here my problem starts:) how?

Look through this example

In the middle of the rule part he converts the Astro datetime to joda time…that’s how I learnt how to do it…

Just a guess, on my phone now so no way to test. I would start with now, and use isBefore(), or in that case isAfter(), like so:


That would almost work. isBefore and isAfter require a DateTime as it’s argument, not a String. So the easiest thing would probably be

now.minusDays(maxOffDays).isAfter(new DateTime(ProgramA_Master_Weather.lastUpdate.toString))

Thank you so much. Will give it a try this weekend.