Modules
Objects/Functions
SuiteScript 2.0
format.Type.{|ADDRESS,CCEXPDATE,CCNUMBER,CCVALIDFROM,CHECKBOX,COLOR,CURRENCY,CURRENCY2,DATE,DATETIME,DATETIMETZ,DOCUMENT,DYNAMICPRECISION,EMAIL,EMAILS,FLOAT,FULLPHONE,FUNCTION,FURIGANA,IDENTIFIER,IDENTIFIERANYCASE,INTEGER,MMYYDATE,NONNEGCURRENCY,NONNEGFLOAT,PACKAGE,PERCENT,PHONE,POSCURRENCY,POSFLOAT,POSINTEGER,QUOTEDFUNCTION,RADIO,RATE,RATEHIGHPRECISION,SELECT,TEXT,TEXTAREA,TIME,TIMEOFDAY,TIMETRACK,URL|}
N/format Module
format.Type
Enum Description:
Enumeration that holds the string values for the supported field types. This enum is used to set the value of the options.type parameter when calling format.format(options) or format.parse(options).
Supported Script Types:
Client and server-side scripts
For more information, see SuiteScript 2.0 Script Types
Module:
N/format Module
Since:
2015.2
Search NetSuite -
https://system.netsuite.com/app/help/helpcenter.nl?search=format.Type
Example:
// Code Example 1
//Run this snippet in debugger to see how values are formatted.
//...
require(['N/format'], function(format) {
Object.getOwnPropertyNames(format.Type).forEach(function(type) {
log.debug(type, format.format({
value: 12345,
type: format.Type[type]
}));
/*use any value instead of 12345 to see how is it formatted*/
})
})
// Code Example 2
// Add additional code
//...
function formatTimeOfDay() {
// Assume the time format is hh:mm (24 hours)
var now = new Date(); // Say it's 7:01PM right now.
var formattedTime = format.format({value: now, type: format.Type.TIMEOFDAY})
});
}
//...
// Add additional code
// Code Example 3
require(['N/format'],
function(format) {
function parseAndFormatDateString()
{
var rawDateString = "07/28/2015";
var parsedDate= format.parse({
value: rawDateString,
type: format.Type.DATE
});
console.log(parsedDate);
}
parseAndFormatDateString();
}
);
//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4388844232.html