Everything You Need to Know

Data Formatting


Truck Chassis

Data is king. Data is the one source of truth in your app. But data needs to be presented in a manner so that users can understand what they are seeing. Truck provides methods to help you format your data.

  • formatNumber
  • sum
  • currency
  • formatTime
  • sortDate
  • sortNumbers
  • sortNumbersDescending

You use these in a template to format the data being rendered by the view:

<script type="text/x-template">
    <h3>Item: ${ }, Price: { $.currency(data.price) }</h3>