OH4: Astro datetimes won't parse

My Astro calculations no longer work because OH can no longer parse datetimes.

[ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'e9b04ffe62' failed: org.graalvm.polyglot.PolyglotException: Error: "Sun_CivilDawn_End (Type=DateTimeItem, State=2023-08-19T06:03:00.000+0100, Label=Civil Dawn Ends, Category=sunrise, Tags=[Point, Timestamp], Groups=[EnvironmentSensors])" is an unsupported type for conversion to time.ZonedDateTime

How do I resolve this?

There is a known bug (might be fixed, I’ve not checked GitHub for a few days) in the underlying openhab-js. It fails to recognize and handle DateTime Item Objects in time.toZDT().

The work around is to use the datetime block with the “state” of the Item instead. That will return the String representation of the date time which can be parsed and will work.

Hopefully this bug fix will get back ported to 4.0.4 when/if that ever happens.