Class: DateTimeConverter

Oracle® JavaScript Extension Toolkit (JET)
16.0.0

F83701-01

Since:
  • 0.6.0
Module:
  • ojconverter-datetime

QuickNav

Usage

Signature:

abstract class DateTimeConverter implements Converter<string>

Typescript Import Format
//To import this class, use the format below.
import {DateTimeConverter} from "ojs/ojconverter-datetime";

For additional information visit:


See:
  • oj.IntlDateTimeConverter JET's implementation of the DateTimeConverter
See:
  • oj.IntlDateTimeConverter JET's implementation of the DateTimeConverter

Methods

(abstract) calculateWeek(value) : {number|undefined}

Returns the calculated week for the isoString value.
Parameters:
Name Type Description
value string to return the calculated week of
Deprecated:
Since Description
11.0.0 This is used internally by the oj-date-picker component, and should not be called by application code.
Returns:

calculated week.

Type
number | undefined

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
Deprecated:
Since Description
11.0.0 The two values should be in the same format: local, offset, or zulu. Create Date objects and compare the Dates.
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
See:
Throws:
a ConverterError if formatting fails.
Type
Error
Returns:

the localized and formatted value suitable for display

Type
string | null

getAvailableTimeZones : {Array}

Gets the supported timezones for the converter.
Deprecated:
Since Description
11.0.0 Use TimeZoneUtils.getAvailableTimeZones instead.
Since:
  • 11.0.0
Returns:

supported timezones

Type
Array

getHint(): string|null

Returns a hint that describes the converter format expected.
Inherited From:
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:
Returns:

an object of options.

Type
Object

(abstract) isDayNameSet():boolean

Returns true if the day name is shown in the date portion; false otherwise.
Deprecated:
Since Description
11.0.0 Use resolvedOptions()["weekday"] !== undefined

(abstract) isDaySet():boolean

Returns true if day is shown in the date portion; false otherwise.
Deprecated:
Since Description
11.0.0 Use resolvedOptions()["day"] !== undefined

(abstract) isHourInAMPMSet():boolean

Returns true if 12-hour is set; false otherwise.
Deprecated:
Since Description
11.0.0 Use !!(resolvedOptions()["hour"] && resolvedOptions()["hour12"])

(abstract) isHourInDaySet():boolean

Returns true if a 24-hour format is set; false otherwise.
Deprecated:
Since Description
11.0.0 Use !!(resolvedOptions()["hour"] && !resolvedOptions()["hour12"])

(abstract) isMilliSecondSet():boolean

Returns true if milliseconds are shown in the time portion; false otherwise.
Deprecated:
Since Description
11.0.0 Use resolvedOptions()["millisecond"] !== undefined

(abstract) isMinuteSet():boolean

Returns true if minutes are shown in the time portion; false otherwise.
Deprecated:
Since Description
11.0.0 Use resolvedOptions()["minute"] !== undefined

(abstract) isMonthSet():boolean

Returns true if month is shown in the date portion; false otherwise.ƒ
Deprecated:
Since Description
11.0.0 Use resolvedOptions()["month"] !== undefined

(abstract) isSecondSet():boolean

Returns true if seconds are shown in the time portion; false otherwise.
Deprecated:
Since Description
11.0.0 Use resolvedOptions()["second"] !== undefined

(abstract) isYearSet():boolean

Returns true if year is shown in the date portion; false otherwise.
Deprecated:
Since Description
11.0.0 Use resolvedOptions()["year"] !== undefined

parse(value) : {string|null}

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
See:
Throws:
a ConverterError if parsing fails
Type
Error
Returns:

the parsed value as a local isoString value

Type
string | null

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:
Returns:

an object of resolved options.

Type
Object