Closed ashwingopalsamy-solaris closed 2 months ago
This is not a GRULE problem, but a general Golang feature:
Integer literal starting with 0 (zero) is treated as octal number (so 08 and 09 didn't make sense).
Got it, thanks for the insight, @ivoshm !
We’ll avoid leading zeros then.
Describe the bug
We have identified an issue with the MakeTime() function (defined in the
ast/BuiltInFunctions.go
) used in our Grule rules. Specifically, when the month is passed as08
or09
(e.g.,MakeTime(2023, 08, 1, 0, 0, 0)
), Grule does not accept this format. Grule expects months to be in a single-digit format without leading zeros (e.g.,MakeTime(2023, 8, 1, 0, 0, 0)
).Important Observation: Grule does accept the format with a leading zero for months
01
to07
(e.g.,MakeTime(2023, 01, 1, 0, 0, 0)
), making this issue specific to months08
and09
.To Reproduce Steps to reproduce the behaviour:
08
or09
with a leading zero(0
).Expected behaviour
Grule should consistently accept month values with or without leading zeros for all months (1-12). The expected behaviour is that the rule should work regardless of whether the month is provided as 08 or 8.
Additional context
Grule Version:
1.15.0
Go Version:1.21
Operating System: Linux