Open
Description
Hi, I have been using govaluate in my code for a long time.. but I faced this issue very recently.
The issue is described as
I wrote my custom function names as getCustomTimestamp
which definition is as below..
"getCustomTimestamp": func(args ...interface{}) (interface{}, error) {
if len(args) != 1 {
return nil, ErrInvalidArguments
}
fmt.Println("Received args:", args)
format, ok := args[0].(string)
if !ok {
return nil, ErrWrongType
}
fmt.Println("Using format:", format)
if !ok {
return nil, ErrWrongType
}
currentTime := time.Now().In(time.FixedZone("IST", 5*60*60+30*60))
formattedTime := currentTime.Format(format)
return formattedTime, nil
},
And what am I doing is passing string 2024-06-10T09:12:00.084Z
to this function and writing an expression which says => getCustomTimestamp("2024-06-10T09:12:00.084Z") or getCustomTimestamp('2024-06-10T09:12:00.084Z')
The logs I received are Received args: [1.71801072e+09]
whereas if I pass a normal string like your-name
then as the output I receive Received args: [your-name]
, I am not getting this.. is this automatically parsing the time in some format. Please help me here.
Metadata
Assignees
Labels
No labels
Activity