Formatters

Formatters can be used to augment the data returned into specific formats. They are used in-line with the data-pv-element that they are formatting.

 <span data-pv-element="slot_start" data-pv-formatter="date(full)">
 </span>

List of Formatters:

  • date() - this is used to format a date to a specific format

    • date(string) - e.g. MMMM MM dd yyyy h:mm tt -allows you to format to a specific date string (based on the .NET string.format rules) If you put in ## we will output st, nd, rd or th based on the day

    • date(month) -display the full month

    • date(day) -display the day number

    • date(year) -display the 4 digit year

    • date(time) -displays the time

    • date(full) -Full Date with Time

  • Currency -this is used to format to USD

  • Phone - this is used to format as a phone number

  • Number -this will format a number with a comma

  • Url -will format as URL (adds HTTP if it doesn't exist)

  • Percent -returns as a %

  • Percentround -returns as a % rounded to whole number

An alternative syntax for using formatters for when the {@@} tags are used

{@slot_start:date(MM/dd/yyyy)@} 
{@total_rate:currency@}

Last updated