summaryrefslogtreecommitdiff
path: root/funcs
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2018-04-19 00:48:53 -0400
committerGitHub <noreply@github.com>2018-04-19 00:48:53 -0400
commit02c8a39fd450efe61e79870a88f47ddeea787eac (patch)
tree471c4d8f303786f7725281a4ae72120fe0e4997d /funcs
parent7ff832bf5764912b12ad328fa618d2c4848ce1f2 (diff)
parent2285105a158822008bf9441b9b5a7e794eb3b70a (diff)
Merge pull request #294 from hairyhenderson/add-parseduration-func
Adding time.ParseDuration function
Diffstat (limited to 'funcs')
-rw-r--r--funcs/time.go5
1 files changed, 5 insertions, 0 deletions
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)