var instance; // Type: wijmo.input.IFormatValidateLib; var returnValue; // Type: string // Parameters var value; // Type: any var formatOrType; // Type: string var options; // Type: any returnValue = instance.format(value, formatOrType, options);
function format( value : any, formatOrType : string, options : any ) : string;
Parameters
- value
The formatting logic to use is decided based on the value type that you set here.
Valid types:
- Javascript date, for example: new Date(2013,8,12)
- Javascript string, for example: "1234567"
- Javascript number, for example: 12345
If the value type is date, the format library uses the logic of wijinputdate.
If the value is a string, the format library uses the logic of wijinputmask.
If the value type is number, the format library uses the logic of wijinputnumber.
- formatOrType
wininputdate
With wijinputdate, the formatOrType parameter is a string value that takes a valid dateFormat object.
wijinputmask
With wijinputmask, the formatOrType parameter is a string value that takes a valid maskFormat object. The regex mask format is invalid.
wijinputnumber
With wijinputnumber, the formatOrType parameter is a string value that takes a valid type value.
- options
wininputdate
With wininputdate, the options parameter is an object that takes five properties or null.
- amDesignator determines the string designator for hours that are "ante meridiem" (before noon).
- culture indicates the culture that the format library uses.
- hour12As0 is a Boolean value that determines the range of hours that can be entered in the control.
- midnightAs0 is a Boolean value that determines whether to express midnight as 24:00.
- pmDesignator determines the string designator for hours that are "post meridiem" (after noon).
For more information about these options, please see InputDate.
wijinputmask
With wijinputmask, the options parameter is an object that takes two properties.
- autoConvert indicates whether to automatically convert the value to the proper format according to the format setting.
- culture indicates the culture that the format library uses.
For more information about these options, please see InputMask.
wijinputnumber
With wijinputnumber, the options parameter is an object that takes eight properties.
- currencySymbol determines the currency symbol when the number type is currency. The default value is according to the culture.
- culture indicates the culture that the format library uses.
- decimalPlaces indicates the number of decimal places to display.
- negativePrefix determines the prefix string used for negative values. The default value is according to culture and type.
- negativeSuffix determines the suffix string used for negative values. The default value is according to culture and type.
- positivePrefix determines the prefix string used for positive values. The default value is according to culture and type.
- positiveSuffix determines the suffix striing used for positive values. The default value is according to culture and type.
- showGroup indicates whether the thousands group separator is inserted between each digital group. (The number of digits in the thousands group depends on the selected culture.)
For more information about these options, please see InputNumber.