Usage
Typescript Import Format
//To import this namespace, use the format below.
import {IntlConverterUtils} from "ojs/ojconverterutils-i18n";
For additional information visit:
Methods
-
(static) dateToLocalIso(date) : {string}
-
Returns a local isoString provided a Date object
Parameters:
Name Type Description date
Date - Since:
- 0.7.0
Returns:
isoString- Type
- string
-
(static) getConverterInstance<T>(converterOption: string|Validation.RegisteredConverter|Converter<T>): Converter<T>|null
-
Given either an Object literal representing a 'converter' option (used in components) or a converter instance of type Converter, this method returns the converter instance. You can also pass in a string. In this case, it will return you an instance of a converter registered with that type.
Parameters:
Name Type Description converterOption
string | Object - Deprecated:
Since Description 8.0.0
Create a converter using its constructor.
- Since:
- 8.0.0
Returns:
converterInstance or null if a converter cannot be determined- Type
- Object | null
-
(static) getInitials(firstName, lastName) : {string|undefined}
-
Returns a person's initials
Parameters:
Name Type Argument Description firstName
string <optional>
first name lastName
string <optional>
last name - Since:
- 4.0.0
Returns:
uppercase concatenation of first letter of first name and first letter of last name. There are the following special cases: - If the name is Arabic characters, it returns empty string. - If the name is Hindi characters, it returns the first letter of the first name. - If the name is Thai characters, it returns the first letter of the first name. - If the name is Korean characters, it returns the first name. - If the name is Japanese or Chinese characters, it returns the last name.- Type
- string | undefined
-
(static) getLocalTimeZoneOffset : {string}
-
Returns the timezone offset between UTC and the local time in Etc/GMT[+-]hh:mm syntax. The offset is positive if the local timezone is behind UTC and negative if it is ahead. The offset range is between Etc/GMT-14 and Etc/GMT+12 (UTC-12 and UTC+14)
Returns:
- Type
- string
-
(static) isoToDate(isoString) : {Date}
-
Parses the isoString and returns a JavaScript Date object
Parameters:
Name Type Description isoString
string isoString to parse and to return Date of Returns:
the parsed JavaScript Date Object- Type
- Date
-
(static) isoToLocalDate(isoString) : {Date}
-
Returns a local Date object provided a local isoString
Parameters:
Name Type Description isoString
string date in isoString format - Since:
- 0.7.0
Returns:
localDate- Type
- Date