"plusDays" causing error?

Hi all,

I am running Openhab2 on Rasbian and I have a rule (based on recommendations here) created.

When starting up my Openhab complains about on rule:

2020-12-04 15:44:43.171 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Error during the execution of startup rule 'Calculate time of day state': 'plusDays' is not a member of 'null'; line 38, column 23, length 36

The rule looks like this (only major parts shown):

rule "Calculate time of day state"
when
  System started or // run at system start in case the time changed when OH was offline
// several events
[...]
then
  // Calculate the times for the static tods and populate the associated Items
  // Update when changing static times
  // Jump to tomorrow and subtract to avoid problems at the change over to/from DST
  val sun_start = new DateTime(vSunrise_Time.state.toString) // Beginn Sonnenaufgang
  val morning_start = now.withTimeAtStartOfDay.plusDays(1).minusHours(18) // Morgen ab 06:00 Uhr
  val night_start = now.withTimeAtStartOfDay.plusDays(1).minusHours(2) // Nacht ab 22:00 Uhr
  val bed_start = now.withTimeAtStartOfDay.plusDays(1).minusHours(1) // Schlafen ab 23:00 Uhr
[...]

If only complains about the first line “val morning_start”. Other lines have the “plusDays”, too.

Anyone having an idea what is wrong here?

Thanks!

/KNEBB