Functions
-
formatWithYearFormat(formatInstance, yearInstance, value) : {string}
-
Merges in the formatted year.
Parameters:
Name Type Description formatInstance
Intl.DateTimeFormat formatInstance: Intl.DateTimeFormat, yearInstance
Intl.DateTimeFormat yearInstance: Intl.DateTimeFormat value
Date Returns:
- Type
- string
-
getDateTimePreferences : {Readonly<DateTimePreferences>}
-
Gets the date and time preferences. If setDateTimePreferences was not called previously, this function will return a default. The default is dateStyle.short.year that is based on the theme. The Redwood theme returns 'numeric' for year.
Application code should not need to call this function. JET code calls this function to merge in the datetime preferences with the IntlDateTimeConverter options.
Returns:
- Type
- Readonly<DateTimePreferences>
-
getNumberPreferences : {Readonly<NumberPreferences>}
-
Gets the number preferences.
Application code should not need to call this function. JET code calls this function to merge in the number preferences with the IntlNumberConverter or NumberConverter options.
Returns:
- Type
- Readonly<NumberPreferences>
-
setDateTimePreferences(options) : {void}
-
Sets the date and time preferences. Once set, the object is frozen, so calling this function a second time will do nothing.
If a user has date time preferences, the application code must call setDateTimePreferences before any JET rendering is started, so when an instance of JET's IntlDateTimeConverter is created during rendering, the preferences will be there to be used. Do not call setDateTimePreferences if there are no preferences to set.
Parameters:
Name Type Description options
DateTimePreferences An object containing the DateTimePreferences to set. Returns:
- Type
- void
Examples
setDateTimePreferences( { dateStyle: {short: {pattern: 'mm/dd/yyyy'}}, timeStyle: {short: { pattern: 'hh:mm' }}, timeZone: 'America/Los_Angeles' } );
setDateTimePreferences( { dateStyle: {short: {pattern: 'mm/dd/yyyy'}}, timeStyle: {short: { pattern: 'hh:mm' }} } );
setDateTimePreferences( { timeZone: 'America/Los_Angeles' } );
-
setNumberPreferences(options) : {void}
-
Sets the number preferences. Once set, the object is frozen, so calling this function a second time will do nothing.
If a user has number preferences, the application code must call setNumberPreferences before any JET rendering is started, so when an instance of JET's IntlNumberConverter or NumberConverter is created during rendering, the preferences will be there to be used. Do not call setNumberPreferences if there are no preferences to set.
Parameters:
Name Type Description options
NumberPreferences An object containing the NumberPreferences to set. Returns:
- Type
- void
Example
setNumberPreferences( { style: { currency: {separators: {group: ",", decimal: "."}}, decimal: {separators: {group: ",", decimal: "."}} } } );
Type Definitions
-
CurrencyStylePreferences
Signature:
{currency: NumberPreferencesSeparators}
-
DateStylePreferencesPattern
-
Properties:
Name Type Description short
{ pattern: string; year?: never } The type for dateStyle.short.pattern. If dateStyle.short.pattern is set, dateStyle.short.year should never be set. -
DateStylePreferencesYear
-
Properties:
Name Type Description short
{ year: 'numeric' | '2-digit'; pattern?: never } The type for short year. -
DateTimePreferences
Signature:
(ojconverter-preferences.DateTimePreferencesYear | ojconverter-preferences.DateTimePreferencesPattern) & {timeZone?: string}
-
DateTimePreferencesPattern
-
Properties:
Name Type Description dateStyle
DateStylePreferencesPattern The user's preferred pattern when the converter's dateStyle option is 'short'. If you set dateStyle.short.pattern, then you must also set timeStyle.short.pattern. timeStyle
TimeStylePreferencesPattern The user's preferred pattern when the converter's timeStyle option is 'short'. If you set timeStyle.short.pattern, then you must also set dateStyle.short.pattern. -
DateTimePreferencesYear
-
Properties:
Name Type Argument Description dateStyle
Partial<ojconverter-preferences.DateStylePreferencesYear> <optional>
The type for the dateStyle.short.year timeStyle
{short?: { pattern: never }} <optional>
If dateStyle.short.year is set, timeStyle.short should never be set. -
DecimalSeparators
Signature:
'.' | ','
-
DecimalStylePreferences
Signature:
{decimal: NumberPreferencesSeparators}
-
GroupSeparators
Signature:
" " | "." | "," | "'"
-
NumberPreferences
Signature:
{style?: Partial<ojconverter-preferences.DecimalStylePreferences> & Partial<ojconverter-preferences.CurrencyStylePreferences>}
-
NumberPreferencesSeparators
Signature:
{separators: ojconverter-preferences.NumberPreferencesSeparatorsContent;}
-
NumberPreferencesSeparatorsContent
Signature:
{group: ojconverter-preferences.GroupSeparators; decimal: ojconverter-preferences.DecimalSeparators;}
-
TimeStylePreferencesPattern
-
Properties:
Name Type Argument Description short
{pattern: string} <optional>
The type for timeStyle.short.pattern.