Add more basic time-related classes for usage in script and rules (#3113)

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
pull/3116/head
Christoph Weitkamp 2022-10-15 09:26:10 +02:00 committed by GitHub
parent ef3b13fce8
commit 389979c9da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -17,7 +17,9 @@ import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.DayOfWeek;
import java.time.Duration;
import java.time.Month;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
@ -159,7 +161,9 @@ public class DefaultScriptScopeProvider implements ScriptExtensionProvider {
// date time static functions
elements.put("ChronoUnit", ChronoUnit.class);
elements.put("DayOfWeek", DayOfWeek.class);
elements.put("Duration", Duration.class);
elements.put("Month", Month.class);
elements.put("ZoneId", ZoneId.class);
elements.put("ZonedDateTime", ZonedDateTime.class);

View File

@ -15,7 +15,9 @@ package org.openhab.core.model.script.scoping;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URLEncoder;
import java.time.DayOfWeek;
import java.time.Duration;
import java.time.Month;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
@ -104,7 +106,9 @@ public class ScriptImplicitlyImportedTypes extends ImplicitlyImportedFeatures {
// date time static functions
result.add(ChronoUnit.class);
result.add(DayOfWeek.class);
result.add(Duration.class);
result.add(Month.class);
result.add(ZoneId.class);
result.add(ZonedDateTime.class);