Functions
datetimeformat
datetimeformat(format='%H:%M / %d-%m-%Y')
or
datetimeformat('%H:%M / %d-%m-%Y')
Formats date to a readable date string. For all possible options, check the official Python docs.
now
Returns a datetime object in the current date and time in UTC.
# Current moment is: 2021-02-18 22:37:27 UTC
{{ now() }}
outputs: 2021-02-18 22:37:27
{{ now() | converttimezone('PST') }}
outputs: 2021-02-18 14:37:27
{{ now() | datetimeformat("%Y-%m-%d") }}
outputs: 2021-02-18
parsejson
'parsejson(JSON string)'
Parses a given JSON string as a JSON object. Most commonly used to parse a user attribute as a list.
User attribute ExampleList = ["ItemA","ItemB","ItemC"]
{{ parsejson(userAttribute['ExampleList]) | first }}
outputs 'ItemA'
range
range(start=0, stop, step=1)
Returns a list containing an arithmetic progression of integers. range(i, j) returns [i, i+1, i+2, ..., j-1]. When step
is given, it specifies the increment (or decrement). For example, range(4) and range(0, 4, 1) both return [0, 1, 2, 3].
skipmessage
Skips sending the current message for the current user.
Use the function with the following syntax:
{{ skipmessage() }}
super
Only usable within blocks, will render the contents of the parent block by calling super.
truncate
truncate(length=255, end="...")
Truncates a given string to a specified length and appends the end
string.
today
Returns a datetime object of the current date at 12 am in UTC. This function does not return the time at the moment of execution (use now() instead). Optional string parameter timezone. Acceptable formats are the ones supported by the java ZoneId class. Examples: CET, UTC+5, America/Los_Angeles
{{ today() }}
outputs: 2020-04-09T00:00Z
{{ today("CET") }}
outputs: 2020-04-09T00:00+02:00[CET]
{{ today()|datetimeformat("%y-%m-%d") }}
outputs: 20-04-09
Updated over 3 years ago