Skip to content

Commit

Permalink
[incubator-kie-issues#69] Fix as per pr suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriele-Cardosi committed Jun 19, 2024
1 parent a69ff0a commit 807a1b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.math.RoundingMode;
import java.time.DateTimeException;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.OffsetTime;
import java.time.ZoneId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.time.temporal.TemporalQueries;

import org.kie.dmn.api.feel.runtime.events.FEELEvent;
import org.kie.dmn.feel.runtime.custom.ZonedOffsetTime;
import org.kie.dmn.feel.runtime.events.InvalidParametersEvent;
import org.kie.dmn.feel.runtime.functions.BaseFEELFunction;
import org.kie.dmn.feel.runtime.functions.BuiltInFunctions;
Expand Down Expand Up @@ -81,6 +82,11 @@ public FEELFnResult<TemporalAccessor> invoke(@ParameterName("from") String val)
// if it does not contain any zone information at all, then I know for certain is a local time.
LocalTime asLocalTime = parsed.query(LocalTime::from);
return FEELFnResult.ofResult(asLocalTime);
} else if (parsed.query(TemporalQueries.zone()) != null) {
LocalTime asLocalTime = parsed.query(LocalTime::from);
ZoneId zoneId = parsed.query(TemporalQueries.zone());
ZonedOffsetTime zonedOffsetTime = ZonedOffsetTime.of(asLocalTime, zoneId);
return FEELFnResult.ofResult(zonedOffsetTime);
}

return FEELFnResult.ofResult(parsed);
Expand Down

0 comments on commit 807a1b6

Please sign in to comment.