Class: DateTimeConverter

Oracle® JavaScript Extension Toolkit (JET)
7.1.0

F18183-01

Signature:

abstract class DateTimeConverter implements Converter<string>

QuickNav


DateTimeConverter

Version:
  • 7.1.0
Since:
  • 0.6
Module:
  • ojvalidation-datetime

Module usage

See JET Module Loading for an overview of module usage within JET.

Javascript Import Format
define(['ojs/ojvalidation-datetime'], function(validationDatetime) {
 // Application should call API on validationDatetime.DateTimeConverter 
})
Typescript Import Format
//To import this class, use the format below.
import {DateTimeConverter} from "ojs/ojvalidation-datetime";

JET In Typescript

A detailed description of working with JET elements and classes in your typescript project can be found at: JET Typescript Usage.

See:

Constructor

(abstract) new DateTimeConverter(options)

In most use cases you will use the ConverterFactory to get an instance of a DateTimeConverter or you will use new oj.IntlDateTimeConverter.
Parameters:
Name Type Argument Description
options Object <optional>
an object literal used to provide an optional information to
See:

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
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
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.
Since:
  • 4.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.

(abstract) isDaySet():boolean

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

(abstract) isHourInAMPMSet():boolean

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

(abstract) isHourInDaySet():boolean

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

(abstract) isMilliSecondSet():boolean

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

(abstract) isMinuteSet():boolean

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

(abstract) isMonthSet():boolean

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

(abstract) isSecondSet():boolean

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

(abstract) isYearSet():boolean

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

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