Macros "hfy-formatter"

Following a list of available predefined macros. Be sure to check the latest version in the definition file itself!

...include

In order to use the predefined twig macros, you have to load them within your own twig template file.

Info: It is suggested to use an import ... as hfyFmt statement, to unify macro usages throughout all twig files.

{% import '@hublify/hublify/macros/_hfy-formatter.html.twig' as hfyFmt %}


byte(val)

Renders a given number in [byte] as a human readable byte-size in e.g. "Kb", "Mb", "Gb", ...

Example

File size is: {{ hfyFmt.byte(2048) }}


taskDuration(val, hPD=8, dPW=5)

Renders a given duration [sec] into a human readable way.

  • val - Number, in seconds.
  • hPD - Number, working-Hours-per-Day. Default is 8.
  • dPW - Number, working-Days-per-Week. Default is 5.

Example

Duration is: {{ hfyFmt.taskDuration(12800) }}