Skip to main content
Function names follow Sprig, a Go template function library, but only the functions listed below are available. Any other function is rejected. The sprig. prefix is optional. A method call passes the result before it as the method’s last argument, so sprig.now().Weekday() means Weekday(sprig.now()). Methods can be chained. A closure is a { ... } expression that list functions such as filter and map run once per item. Inside it, # is the item, so { #.status == 'done' } is true for items whose status is done. #.field, .field and [0] read from the item. Closures support string, number, boolean and nil literals, == != > < >= <=, and/or/not (or && || !) and + - * /. Arithmetic and comparisons only work inside closures. String:
  • len(value): Number of characters in a string, items in a list, or keys in an object.
  • upper(string): Upper-cases string.
  • lower(string): Lower-cases string.
  • trim(string): Removes leading and trailing whitespace.
  • substr(start, end, string): Characters from index start to end, both inclusive (unlike Sprig): substr(0, 3, "hello") is "hell".
  • replace(old, new, string): Replaces every old in string with new.
  • contains(substring, string): Whether string contains substring.
Number:
  • int(value): Integer from an integer or a numeric string; also maps "Monday".."Sunday" to 1..7.
  • asInt(value): Integer from an integer or a numeric string.
  • randInt(min, max): Random integer from min to max, both inclusive.
Date and time:
  • now(): Current UTC date and time.
  • date(layout, time): Formats time with a Go layout, such as "2006-01-02 15:04:05", "Jan 2", "MST", "-0700".
  • Format(layout, time): Same as date, usually called as a method: sprig.now().Format("15:04").
  • Year(time): Year as a string, such as "2024".
  • Month(time): Month name, such as "March".
  • Day(time): Day of the month as a string, such as "5".
  • Hour(time): Hour (0-23) as a string.
  • Minute(time): Minute as a string.
  • Second(time): Second as a string.
  • Weekday(time): Weekday name, such as "Tuesday"; int turns it into 1..7.
  • YearDay(time): Day of the year as a string, such as "65".
  • unixEpoch(time): Seconds since the Unix epoch; time can also be an RFC 3339 string.
  • duration(string): Parses a Go duration like "90m", "1h30m" or "-1.5h", for Add and Truncate.
  • Add(duration, time): time shifted by duration: sprig.now().Add(sprig.duration("-24h")).
  • Truncate(duration, time): time rounded down to a multiple of duration, as in Go.
  • dateModify(offset, time): time shifted by an offset of hours, minutes and seconds, such as "-1h30m".
  • date_modify(offset, time): Same as dateModify.
List:
  • list(value, ...): List of the arguments.
  • first(list): First item, or null for an empty list.
  • chunk(size, list): Splits list into lists of size items.
  • filter(list, closure): Items for which closure is true.
  • map(list, closure): Result of closure for each item.
  • find(list, closure): First item for which closure is true, or null.
  • count(list, closure): Number of items for which closure is true.
  • all(list, closure): Whether closure is true for every item.
  • any(list, closure): Whether closure is true for at least one item.
  • none(list, closure): Whether closure is false for every item.
  • one(list, closure): Whether closure is true for exactly one item.
Values:
  • default(fallback, value): value, or fallback when value is empty.
  • empty(value): Whether value is null, false, 0, "", [] or {}.
  • string(value): Debug representation, not a conversion: a string comes back wrapped in quotes and an object as %{"key" => value}. Use toJson to serialize.
Encoding:
  • toJson(value): Encodes value as a JSON string.
  • toJSON(value): Same as toJson.
  • fromJson(string): Decodes a JSON string; invalid JSON fails the task.
  • fromJSON(string): Same as fromJson.
  • b64enc(string): Base64-encodes string.
  • b64dec(string): Base64-decodes string; invalid input gives the text "illegal base64 data" instead of failing.
  • b32enc(string): Base32-encodes string.
  • b32dec(string): Base32-decodes string; invalid input gives the text "illegal base32 data" instead of failing.
Examples:
  • String: {"value": "{{ sprig.lower($.title).replace(\" \", \"-\") }}", "source": "fetch_post", "type": "task"} turns the title My Title from fetch_post into my-title.
  • Date: {{ sprig.now().Add(sprig.duration("-24h")).Format("2006-01-02") }} is yesterday’s date, such as 2026-10-20.
  • List: {{ sprig.filter($.items, { #.status == 'done' }) }} keeps the items whose status is done.