1 | /**
|
2 | * @name Globalization
|
3 | * @description
|
4 | * @usage
|
5 | * ```typescript
|
6 | * import { Globalization } from 'ionic-native';
|
7 | *
|
8 | *
|
9 | * ```
|
10 | */
|
11 | export declare class Globalization {
|
12 | /**
|
13 | * Returns the BCP-47 compliant language identifier tag to the successCallback with a properties object as a parameter. That object should have a value property with a String value.
|
14 | * @returns {Promise<{value: string}>}
|
15 | */
|
16 | static getPreferredLanguage(): Promise<{
|
17 | value: string;
|
18 | }>;
|
19 | /**
|
20 | * Returns the BCP 47 compliant locale identifier string to the successCallback with a properties object as a parameter.
|
21 | * @returns {Promise<{value: string}>}
|
22 | */
|
23 | static getLocaleName(): Promise<{
|
24 | value: string;
|
25 | }>;
|
26 | /**
|
27 | * Converts date to string
|
28 | * @param {Date} date Date you wish to convert
|
29 | * @param options Options for the converted date. Length, selector.
|
30 | * @returns {Promise<{value: string}>} Returns a promise when the date has been converted.
|
31 | */
|
32 | static dateToString(date: Date, options: {
|
33 | formatLength: string;
|
34 | selector: string;
|
35 | }): Promise<{
|
36 | value: string;
|
37 | }>;
|
38 | /**
|
39 | * 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.
|
40 | * @param {string} dateString Date as a string to be converted
|
41 | * @param options Options for the converted date. Length, selector.
|
42 | * @returns {Promise<{ year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number }>} Returns a promise when the date has been converted.
|
43 | */
|
44 | static stringToDate(dateString: string, options: {
|
45 | formatLength: string;
|
46 | selector: string;
|
47 | }): Promise<{
|
48 | year: number;
|
49 | month: number;
|
50 | day: number;
|
51 | hour: number;
|
52 | minute: number;
|
53 | second: number;
|
54 | millisecond: number;
|
55 | }>;
|
56 | /**
|
57 | * Returns a pattern string to format and parse dates according to the client's user preferences.
|
58 | * @param options Object with the format length and selector
|
59 | * @returns {Promise<{pattern: string}>} Returns a promise.
|
60 | */
|
61 | static getDatePattern(options: {
|
62 | formatLength: string;
|
63 | selector: string;
|
64 | }): Promise<{
|
65 | pattern: string;
|
66 | }>;
|
67 | /**
|
68 | * Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar.
|
69 | * @param options Object with type (narrow or wide) and item (month or days).
|
70 | * @returns {Promise<{value: Array<string>}>} Returns a promise.
|
71 | */
|
72 | static getDateNames(options: {
|
73 | type: string;
|
74 | item: string;
|
75 | }): Promise<{
|
76 | value: Array<string>;
|
77 | }>;
|
78 | /**
|
79 | * Indicates whether daylight savings time is in effect for a given date using the client's time zone and calendar.
|
80 | * @param {data} date Date to process
|
81 | * @returns {Promise<{dst: string}>} reutrns a promise with the value
|
82 | */
|
83 | static isDayLightSavingsTime(date: Date): Promise<{
|
84 | dst: string;
|
85 | }>;
|
86 | /**
|
87 | * Returns the first day of the week according to the client's user preferences and calendar.
|
88 | * @returns {Promise<{value: string}>} returns a promise with the value
|
89 | */
|
90 | static getFirstDayOfWeek(): Promise<{
|
91 | value: string;
|
92 | }>;
|
93 | /**
|
94 | * Returns a number formatted as a string according to the client's user preferences.
|
95 | * @param numberToConvert {Number} The number to convert
|
96 | * @param options {Object} Object with property `type` that can be set to: decimal, percent, or currency.
|
97 | */
|
98 | static numberToString(numberToConvert: number, options: {
|
99 | type: string;
|
100 | }): Promise<{
|
101 | value: string;
|
102 | }>;
|
103 | /**
|
104 | *
|
105 | * @param {string} stringToConvert String you want to conver to a number
|
106 | * @param options The type of number you want to return. Can be decimal, percent, or currency.
|
107 | * @returns {Promise<{ value: number | string }>} Returns a promise with the value.
|
108 | */
|
109 | static stringToNumber(stringToConvert: string, options: {
|
110 | type: string;
|
111 | }): Promise<{
|
112 | value: number | string;
|
113 | }>;
|
114 | /**
|
115 | * Returns a pattern string to format and parse numbers according to the client's user preferences.
|
116 | * @param options Can be decimal, percent, or currency.
|
117 | * @returns {Promise<{ pattern: string, symbol: string, fraction: number, rounding: number, positive: string, negative: string, decimal: string, grouping: string }>}
|
118 | */
|
119 | static getNumberPattern(options: {
|
120 | type: string;
|
121 | }): Promise<{
|
122 | pattern: string;
|
123 | symbol: string;
|
124 | fraction: number;
|
125 | rounding: number;
|
126 | positive: string;
|
127 | negative: string;
|
128 | decimal: string;
|
129 | grouping: string;
|
130 | }>;
|
131 | /**
|
132 | * Returns a pattern string to format and parse currency values according to the client's user preferences and ISO 4217 currency code.
|
133 | * @param {string} currencyCode Currency Code.A
|
134 | * @returns {Promise<{ pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string }>}
|
135 | */
|
136 | static getCurrencyPattern(currencyCode: string): Promise<{
|
137 | pattern: string;
|
138 | code: string;
|
139 | fraction: number;
|
140 | rounding: number;
|
141 | decimal: number;
|
142 | grouping: string;
|
143 | }>;
|
144 | }
|