Calculation of Timedifferences in DSL-Rules produces Errors (OH5.2.0-SNAPSHOT - Build #5309)

Pi5/8GB(PiOS Lite 64-bit(trixie)/SSD 120GB - OH5.1. openhabian
(Test openHAB 5.2.0-SNAPSHOT - Build #5309 - RPi 5/8 / M.2 SSD)

rule "Datum testen_test"
  when
//    Item Dummy_blind changed to "100"
    Item Dummy_11 changed to ON
     
  then

    var LocalDate endofCentury = LocalDate.of(2000, 01, 01)
    var LocalDate just = LocalDate.now()

    var diff = Period.between(endofCentury, just)
   logInfo("datediff", "diff between  Years: {}  Months: {} Days: {} - diff ist {}", diff.getYears, diff.getMonths, diff.getDays, diff)

   val heute   = now.toLocalDate
   val abholTag = (Spring_Start_Met.state as DateTimeType).getZonedDateTime(ZoneId.systemDefault).toLocalDate
   val delta = ChronoUnit.DAYS.between(heute, abholTag)
   logInfo("datediff-delta", "delta between  Years: {}  Months: {} Days: {} - diff ist {}", delta)

end

This Rule calculates the difference of 2 DateTimes and works quit fine in OH5.1.4

Result:

2026-04-19 14:51:31.604 [INFO ] [g.openhab.core.model.script.datediff] - diff between  Years: 26  Months: 3 Days: 18 - diff ist P26Y3M18D
2026-04-19 14:51:31.607 [INFO ] [hab.core.model.script.datediff-delta] - delta between  Years: -49  Months: {} Days: {} - diff ist {}

In OH5.2.0-Snapshot#5309 the Rule no longer works and shows the following warning-message in the log:

2026-04-19 15:50:09.819 [WARN ] [el.core.internal.ModelRepositoryImpl] - DSL model 'test_datum_test.rules' has errors, therefore ignoring it: [11,23]: no viable alternative at input 'between'
[16,32]: no viable alternative at input 'between'

Does anyone know the reason as I found no clue to fix.

Thx in advance for help.

Cheers - Peter

This is because “between” is a new keyword.
I am working to remove some of these new introduced keywords, including “between”.
And we have found a possible solution to avoid these collisions.

In the meanwhile, as a workaround, it should be possible to “escape” keywords with ^, so it should work if you change it to:

ChronoUnit.DAYS.^between(heute, abholTag)

Thx for the hint with the exponent-sign as workaround. :+1: