Learn how to usevariable formattersto display information in the format you need in your documents or templates. Formatters allow you to transform how a value appears (without changing the original data), for example, converting numbers to words or modifying the format of a date.
What are formatters?
Formatters (formerly called “filters”) are used totransform existing variables, modifying how they are displayed within your documents or communications.
They are applied by writing a vertical bar (|) after the variable name, followed by the formatter you want to use. Here is an example:
{{ finiquito.monto | palabras }}Transfers the numeric value of the amount into words.
Available formatters
Below are the formatters to add after the vertical bar (|).
📝 words
Converts a numeric or date-type variable to its version in words. If the variable is neither numeric nor a date, no transformation is performed.
{{ finiquito.monto | palabras }}🖼️ image
Displays an image from its path. It is mainly used withcustom file-type attributesthat contain images.
{{ empresa.logo | imagen: "200", "100" }}The first value corresponds to thewidthand the second to theheight(in pixels).
📅 date_format
Allows you to display a date in the format you need.
{{ fecha_de_hoy | formato_fecha: "yyyy-mm-dd" }}Available attributes:
-
yyyy→ Full year (2020) -
mm→ Numeric month (07) -
dd→ Day of the month (31) -
hh→ Hour (16) -
MM→ Minutes (59) -
ss→ Seconds (59)
Available separators: /,-or space.
🧩 date_detail
Gets a specific element from a date (day, month, or year).
{{ fecha_de_hoy | detalle_fecha: "M" }}Available parameters:
-
"A"→ Year -
"M"→ Month -
"D"→ Day
If not used correctly, it returns an empty value.
📖 date_in_words
Transforms a date into a written-out version in words.
{{ fecha_de_hoy | fecha_en_palabras: "%A %d de %B de %Y" }}Available formats:
-
%A→ Day of the week -
%d→ Numeric day -
%b→ Month abbreviation -
%B→ Full month name -
%Y→ Full year -
%y→ Last two digits of the year
Example result:
If the date is30/03/2020, the result will be:
Monday, March 30, 2020
⏳ date_n_months_in_future
Returns the date in01/mm/yyyyformat by adding N months to the original value.
{{ fecha_de_hoy | fecha_n_meses_al_futuro: "3" }}Displays the date three months after the current date.
🔢 remove_zero
Removes the “.0” decimals from a number.
{{ empleado.horas_semanales | remove_zero }}If the original value is “40.0”, it will display “40”.
💰 formatted_amount
Displays the amount in currency format ($ ###.###).
{{ empleado.total_descuentos_ultima_liquidacion | monto_con_formato }}Result: $ 1,234,567
💬 amount_with_decimals_in_words
Converts a numeric amount to words, including decimals as a fraction (x/100).
{{ empleado.total_liquidacion | monto_con_decimales_a_palabras }}If the value is
1534.50, it will display “one thousand five hundred thirty-four and 50/100”.
🔠 to_uppercase
Converts text to uppercase.
{{ empleado.nombre_completo | convertir_a_mayusculas }}If the name is “Ana Pérez”, it will display “ANA PÉREZ”.
📊 number_format
Applies numeric formatting with thousand separator (.) and two decimals separated by a comma (,).
{{ 1000000 | formato_numero }}Result: 1,000,000.00
Important considerations
- If the formatter is not used correctly, the variable will be displayedwithout modifications.
- You cancombine formattersin a single variable:
{{ finiquito.monto | remove_zero | monto_con_formato }}- Formatters only affect theway the value is displayed, they do not modify the original data in the database.
💡Still have questions?
If this article does not fully answer your question or you need support with a specific case, our team is available through our support channels.
Chat | Phone | Email
🎓Are you interested in getting certified in Buk?
We invite you to take a course of your interest at Buk Academy, where you will find guided content to deepen your use of the platform and strengthen your knowledge.
🤖 This article was translated using artificial intelligence. View original article.