-
-
Notifications
You must be signed in to change notification settings - Fork 458
Closed
Labels
bugAn unexpected problem or unintended behavior of the CoreAn unexpected problem or unintended behavior of the Core
Description
ChronoUnit is one of the enums imported by default in rules DSL.
Expected usage (and it used to work like that) is something like:
var today = now.truncatedTo(ChronoUnit.DAYS)
See example in documentation: https://next.openhab.org/docs/configuration/persistence.html#examples
In the current version of OH, it does not work like that anymore.
This fails:
chronoUnit = ChronoUnit.DAYS
logInfo("Test", chronoUnit.toString)
today = now.truncatedTo(ChronoUnit.DAYS)
logInfo("Test", today.toString)
Error message:
09:12:15.689 [ERROR] [.handler.AbstractScriptModuleHandler] - Script execution of rule with UID 'test' failed: The name 'ChronoUnit' cannot be resolved to an item or type; line 5, column 18, length 10 in test
However, this now works:
var chronoUnit = DAYS
logInfo("Test", chronoUnit.toString)
var today = now.truncatedTo(DAYS)
logInfo("Test", today.toString)
Note that it still works for some other enums. The following all works
var day = DayOfWeek.TUESDAY
logInfo("Test", day.toString)
var month = Month.FEBRUARY
logInfo("Test", month.toString)
I found this out when trying to investigate #4784. I don't know if this is related.
Metadata
Metadata
Assignees
Labels
bugAn unexpected problem or unintended behavior of the CoreAn unexpected problem or unintended behavior of the Core