This API obtains information and performs operations specific to the user's locale, language, and timezone.
Globalization.getPreferredLanguage()
.then(res => console.log(res.value))
.catch(e => console.log(e));
...
Globalization.getDateNames()
.then(res => console.log(res.value))
.catch(e => console.log(e));
window.Globalization.getPreferredLanguage()
.then((res) => console.log(res.value))
.catch((e) => console.log(e));
...
window.Globalization.getDateNames()
.then((res) => console.log(res.value))
.catch((e) => console.log(e));
window.Globalization.getPreferredLanguage()
.then((res) => console.log(res.value))
.catch((e) => console.log(e));
...
window.Globalization.getDateNames()
.then((res) => console.log(res.value))
.catch((e) => console.log(e));
(<any>window).Globalization.getPreferredLanguage()
.then((res) => console.log(res.value))
.catch((e) => console.log(e));
...
(<any>window).Globalization.getDateNames()
.then((res) => console.log(res.value))
.catch((e) => console.log(e));
window.Globalization.getPreferredLanguage()
.then((res) => console.log(res.value))
.catch((e) => console.log(e));
...
window.Globalization.getDateNames()
.then((res) => console.log(res.value))
.catch((e) => console.log(e));
dateToString(date: Date, options: GlobalizationOptions): Promise <ObjectResult>
Converts date to string
getCurrencyPattern(currencyCode: string): Promise <GetCurrencyPatternResult>
Returns a pattern string to format and parse currency values according to the client's user preferences and ISO 4217 currency code.
getDateNames(options: DateNamesOptions): Promise <ObjectResult>
Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar.
getDatePattern(options: GlobalizationOptions): Promise <ObjectResult>
Returns a pattern string to format and parse dates according to the client's user preferences.
getFirstDayOfWeek(): Promise <ObjectResult>
Returns the first day of the week according to the client's user preferences and calendar.
getLocaleName(): Promise <ObjectResult>
Returns the BCP 47 compliant locale identifier string to the successCallback with a properties object as a parameter.
getNumberPattern(options: GetNumberPatternOptions): Promise <GetNumberPatternResult>
Returns a pattern string to format and parse numbers according to the client's user preferences.
getPreferredLanguage(): Promise <ObjectResult>
Returns the BCP-47 compliant language identifier tag with properties object as a parameter. That object should have a value property with a String value.
isDayLightSavingsTime(date: Date): Promise <IsDayLightSavingsTimeResult>
Indicates whether daylight savings time is in effect for a given date using the client's time zone and calendar.
numberToString(numberToConvert: int, options: NumberToStringOptions): Promise <ObjectResult>
Returns a number formatted as a string according to the client's user preferences.
stringToDate(dateString: string, options: StringToDateOptions): Promise <StringToDateResult>
Parses a date formatted as a string, according to the client's user preferences and calendar using the time zone of the client, and returns the corresponding date object.
stringToNumber(stringToConvert: string, options: StringToNumberOptions): Promise <ObjectResult>
interface DateToStringResult { // Date you wish to convert date: Date; // Options for the converted date. Length, selector options: GlobalizationOptions; }
interface GetDateNamesOptions { item: string; type: string; }
interface GetCurrencyPatternResult { pattern: string; code: string; fraction: int; rounding: int; decimal: string; grouping: string; }
interface ObjectResult { value: string; }
interface GetNumberPatternOptions { // Can be decimal, percent, or currency type: GlobalizationOptions; }
interface GetNumberPatternResult {
// Can be decimal, percent, or currency
type: string;
}
interface IsDayLightSavingsTimeResult {
// Indicates whether or not daylight savings time is in effect
dst: boolean;
}
interface NumberToStringOptions { type: string; }
interface StringToDateOptions { // Date as a string to be converted dateString: string; // Options for the converted date. Length, selector options: GlobalizationOptions; }
interface StringToDateResult { // The four digit year year: int; // The month from (0-11) month: int; // The day from (1-31) day: int; // The hour from (0-23) hour: int; // The minute from (0-59) minute: int; // The second from (0-59) second: int; // The milliseconds (from 0-999) millisecond: int; }
interface StringToNumberOptions { type: string; }
interface GlobalizationOptions { formatLength: string; selector: string; }