Taking advantages of filters
You can improve the values you receive from your server by applying filters that will convert the data to something more readable.
number
Will convert a value in a readable number, such as "999,999"
response.quantity|number
=> 999,999
price
Will convert a value into a number. You can pass the currency which defaults to "$" and round the thousands as "k".
response.amount|price
=> $999,999response.amount|price('€')
=> €999,999response.amount|price(thousands=True)
=> $999kresponse.amount|price('€', thousands=true)
=> €999k
datetime
Will convert a string into a datetime that you can then manipulate. We accept a string in Isoformat, a standard "YYYY-MM-DD HH:mm:ss", a timestamp (both in seconds or miliseconds). You can pass a parameter to define the output format. We follow the format from https://strftime.org:
response.created|datetime
=> "2025-05-25 13:37"response.created|datetime('%Y-%m-%d')
=> "2025-05-25"
relative
Convert a date in relative format from now. It can either be in the past or the future and the output will adjust ("xx days ago" or "in xx days").
response.created|relative
=> "2 months ago"
timedelta
Allows you to add a period to a given date. We accepts years, months, days, hours, minutes and seconds as parameter (all in their plural form) and you can pass more than one at once.
response.remove_in|timedelta(days=7)
response.update_at|timedelta(hours=-2)
Know that you can also combine them.
For instance, the following is absolutely possible:
response.created_at|timedelta(hours=-2)|relative