From 2285105a158822008bf9441b9b5a7e794eb3b70a Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Thu, 19 Apr 2018 00:44:40 -0400 Subject: Adding time.ParseDuration function Signed-off-by: Dave Henderson --- funcs/time.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'funcs') diff --git a/funcs/time.go b/funcs/time.go index a1940584..111b0b23 100644 --- a/funcs/time.go +++ b/funcs/time.go @@ -138,6 +138,11 @@ func (f *TimeFuncs) Hour(n interface{}) gotime.Duration { return gotime.Hour * gotime.Duration(conv.ToInt64(n)) } +// ParseDuration - +func (f *TimeFuncs) ParseDuration(n interface{}) (gotime.Duration, error) { + return gotime.ParseDuration(conv.ToString(n)) +} + // convert a number input to a pair of int64s, representing the integer portion and the decimal remainder // this can handle a string as well as any integer or float type // precision is at the "nano" level (i.e. 1e+9) -- cgit v1.2.3