Caplin Trader 4.0.3

Class: module:br/presenter/formatter/DateFormatter

module:br/presenter/formatter/DateFormatter

Summary

Formats a date value by converting it from a specified input format to a new output format.

DateFormatter is typically used with Presenter, but can be invoked programmatically as in the following examples which evaluate to "09-Sep-2001 01:46:40" and "2001Sep09" respectively:

br.presenter.formatter.DateFormatter.format(1e12, {inputFormat:"U"})
br.presenter.formatter.DateFormatter.format(1e12, {inputFormat:"U", outputFormat:"YMd"})

See module:br/presenter/parser/DateParser for the complementary parser.

Constructor

new module:br/presenter/formatter/DateFormatter()

Implements:

Methods

format(vValue, mAttributes)

Formats a date by converting it from a specified input format to a new output format.

Attribute Options:

Option Description
inputFormat format of the input date, expressed with Moment.js format tokens (defaults to DD-MM-YYYY HH:mm:ss).
outputFormat format of the output date, expressed with Moment.js format tokens (defaults to DD-MM-YYYY HH:mm:ss).
adjustForTimezone boolean value representing whether the formatter should adjust the date according to the client's timezone
Parameters:
Name Type Description
vValue Variant the input date (String or Date type).
mAttributes Map the map of attributes.
Implements:
Returns:
the output date.