Class: DateTimeConverter

Oracle® JavaScript Extension Toolkit (JET)
3.2.0

E87541-01

QuickNav

oj. DateTimeConverter extends oj.Converter

Version:
  • 3.2.0
Since:
  • 0.6

Constructor

new DateTimeConverter(options)

Parameters:
Name Type Argument Description
options Object <optional>
an object literal used to provide an optional information to
Source:

Methods

calculateWeek()

Returns the calculated week for the isoString value.
Source:

compareISODates(isoStr, isoStr2) → {number}

Compares 2 ISO 8601 strings, returning the time difference between the two
Parameters:
Name Type Description
isoStr string first iso string
isoStr2 string second iso string
Source:
Returns:
the time difference between isoStr and isoStr2
Type
number

format(value) → {string|null}

Formats the local isoString value using the options provided and returns a string value. Note that if previous application code was passing a JavaScript Date object which is no longer supported, one can use the utility function oj.IntlConverterUtils.dateToLocalIso to get the proper isoString value.
Parameters:
Name Type Description
value string to be formatted for display which should be a local isoString
Source:
See:
Throws:
a ConverterError if formatting fails.
Type
Error
Returns:
the localized and formatted value suitable for display
Type
string | null
Example
 For example converter.format(oj.IntlConverterUtils.dateToLocalIso(new Date()))

getHint() → {String|null}

Returns a hint that describes the converter format expected.
Inherited From:
Source:
Returns:
a hint describing the format the value is expected to be in.
Type
String | null

getOptions() → {Object}

Returns the options called with converter initialization.
Inherited From:
Source:
Returns:
an object of options.
Type
Object

Init(options)

Initializes the date time converter instance with the set options.
Parameters:
Name Type Argument Description
options Object <optional>
an object literal used to provide an optional information to initialize the converter.

Source:

isDayNameSet()

Returns true if the day name is shown in the date portion; false otherwise.
Source:

isDaySet()

Returns true if day is shown in the date portion; false otherwise.
Source:

isHourInAMPMSet()

Returns true if 12-hour is set; false otherwise.
Source:

isHourInDaySet()

Returns true if a 24-hour format is set; false otherwise.
Source:

isMilliSecondSet()

Returns true if milliseconds are shown in the time portion; false otherwise.
Source:

isMinuteSet()

Returns true if minutes are shown in the time portion; false otherwise.
Source:

isMonthSet()

Returns true if month is shown in the date portion; false otherwise.
Source:

isSecondSet()

Returns true if seconds are shown in the time portion; false otherwise.
Source:

isYearSet()

Returns true if year is shown in the date portion; false otherwise.
Source:

parse(value) → {string}

Parses the value using the options provided and returns a local isoString value. For convenience if one wishes to retrieve a JavaScript Date object from the local isoString an utility function oj.IntlConverterUtils.isoToLocalDate is provided.
Parameters:
Name Type Description
value string to parse
Source:
See:
Throws:
a ConverterError if parsing fails
Type
Error
Returns:
the parsed value as a local isoString value
Type
string
Example
 For example oj.IntlConverterUtils.isoToLocalDate(converter.parse(isoString))

resolvedOptions() → {Object}

Returns an object literal with locale and formatting options computed during initialization of the object. If options was not provided at the time of initialization, the properties will be derived from the locale defaults.
Inherited From:
Source:
Returns:
an object of resolved options.
Type
Object