Options
All
  • Public
  • Public/Protected
  • All
Menu

Formatter methods which can be used with Field.getFormatter and Field.setFormatter.

The methods in this class return a function for use with the formatter methods. Each method may define its own parameters that configure how the formatter operates. For example the date / time formatters take information on the formatting to be used.

export

Hierarchy

  • Format

Index

Constructors

Methods

  • dateTime(from: string, to: string): IFormatter
  • Convert from one date time format to another.

    Uses MomentJS - formats are defined by Moment.

    static

    Parameters

    • from: string

      From format

    • to: string

      To format.

    Returns IFormatter

    Configured formatter function

  • explode(delimiter?: string): IFormatter
  • Convert a string of values into an array for use with checkboxes.

    static

    Parameters

    • delimiter: string = '|'

    Returns IFormatter

    Configured formatter function

  • formatToSqlDate(format: string): IFormatter
  • Convert to SQL date / date time format (ISO8601) from a format given by the options parameter. Typically used with a set formatter.

    Uses MomentJS - formats are defined by Moment.

    static

    Parameters

    • format: string

      Format to convert from.

    Returns IFormatter

    Configured formatter function

  • fromDecimalChar(char?: string): IFormatter
  • Convert a number from using any character other than a period (dot) to one which does use a period. This is useful for allowing numeric user input in regions where a comma is used as the decimal character. Use with a set formatter.

    static

    Parameters

    • char: string = ','

    Returns IFormatter

    Configured formatter function

  • ifEmpty(emptyValue: any): IFormatter
  • Convert an empty string to null. Null values are very useful in databases, but HTTP variables have no way of representing null as a value, often leading to an empty string and null overlapping. This method will check the value to operate on and return null if it is empty.

    static

    Parameters

    • emptyValue: any

      Value to use if an empty value is submitted. null is the typical value.

    Returns IFormatter

    Configured formatter function

  • implode(delimiter?: string): IFormatter
  • Convert an array of values from a checkbox into a string which can be used to store in a text field in a database.

    static

    Parameters

    • delimiter: string = '|'

    Returns IFormatter

    Configured formatter function

  • sqlDateToFormat(format: string): IFormatter
  • Convert from SQL date / date time format (ISO8601) to a format given by the options parameter. Typically used with a get formatter.

    Uses MomentJS - formats are defined by Moment.

    static

    Parameters

    • format: string

      Format to convert to.

    Returns IFormatter

    Configured formatter function

  • toDecimalChar(char?: string): IFormatter
  • Convert a number with a period (dot) as the decimal character to use a different character (typically a comma). Use with a get formatter.

    static

    Parameters

    • char: string = ','

    Returns IFormatter

    Configured formatter function

Generated using TypeDoc