{"id":15096865,"url":"https://github.com/apache/cordova-plugin-globalization","last_synced_at":"2025-10-08T01:30:21.051Z","repository":{"id":48904393,"uuid":"10860601","full_name":"apache/cordova-plugin-globalization","owner":"apache","description":"[DEPRECATED] Apache Cordova Plugin globalization","archived":true,"fork":false,"pushed_at":"2021-07-06T08:38:54.000Z","size":5380,"stargazers_count":140,"open_issues_count":0,"forks_count":111,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-01-20T09:38:53.123Z","etag":null,"topics":["cordova","cplusplus","csharp","java","javascript","library","mobile","nodejs","objective-c"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apache.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-06-22T07:00:16.000Z","updated_at":"2024-11-28T14:36:47.000Z","dependencies_parsed_at":"2022-09-13T20:11:36.132Z","dependency_job_id":null,"html_url":"https://github.com/apache/cordova-plugin-globalization","commit_stats":null,"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fcordova-plugin-globalization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fcordova-plugin-globalization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fcordova-plugin-globalization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fcordova-plugin-globalization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apache","download_url":"https://codeload.github.com/apache/cordova-plugin-globalization/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235669382,"owners_count":19026815,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cordova","cplusplus","csharp","java","javascript","library","mobile","nodejs","objective-c"],"created_at":"2024-09-25T16:01:58.325Z","updated_at":"2025-10-08T01:30:14.925Z","avatar_url":"https://github.com/apache.png","language":"JavaScript","readme":"---\ntitle: Globalization\ndescription: Access locale data.\n---\n\u003c!--\n# license: Licensed to the Apache Software Foundation (ASF) under one\n#         or more contributor license agreements.  See the NOTICE file\n#         distributed with this work for additional information\n#         regarding copyright ownership.  The ASF licenses this file\n#         to you under the Apache License, Version 2.0 (the\n#         \"License\"); you may not use this file except in compliance\n#         with the License.  You may obtain a copy of the License at\n#\n#           http://www.apache.org/licenses/LICENSE-2.0\n#\n#         Unless required by applicable law or agreed to in writing,\n#         software distributed under the License is distributed on an\n#         \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n#         KIND, either express or implied.  See the License for the\n#         specific language governing permissions and limitations\n#         under the License.\n--\u003e\n\n|AppVeyor|Travis CI|\n|:-:|:-:|\n|[![Build status](https://ci.appveyor.com/api/projects/status/github/apache/cordova-plugin-globalization?branch=master)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/cordova-plugin-globalization)|[![Build Status](https://travis-ci.org/apache/cordova-plugin-globalization.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-globalization)|\n\n# cordova-plugin-globalization\n\nThis plugin obtains information and performs operations specific to the user's\nlocale, language, and timezone. Note the difference between locale and language:\nlocale controls how numbers, dates, and times are displayed for a region, while\nlanguage determines what language text appears as, independently of locale settings.\nOften developers use locale to set both settings, but there is no reason a user\ncouldn't set her language to \"English\" but locale to \"French\", so that text is\ndisplayed in English but dates, times, etc., are displayed as they are in France.\nUnfortunately, most mobile platforms currently do not make a distinction between\nthese settings.\n\nThis plugin defines global `navigator.globalization` object.\n\nAlthough in the global scope, it is not available until after the `deviceready` event.\n```js\n    document.addEventListener(\"deviceready\", onDeviceReady, false);\n    function onDeviceReady() {\n        console.log(navigator.globalization);\n    }\n```\n\nReport issues with this plugin on the [Apache Cordova issue tracker](https://issues.apache.org/jira/issues/?jql=project%20%3D%20CB%20AND%20status%20in%20%28Open%2C%20%22In%20Progress%22%2C%20Reopened%29%20AND%20resolution%20%3D%20Unresolved%20AND%20component%20%3D%20%22Plugin%20Globalization%22%20ORDER%20BY%20priority%20DESC%2C%20summary%20ASC%2C%20updatedDate%20DESC)\n\n\n### Deprecation Notice\n\nWith the [ECMA Internationalization API](https://www.ecma-international.org/ecma-402/1.0/) now supported on iOS, Android and Windows devices, this plugin is not required any more. Migrating from this plugin to the [ECMA Internationalization API](https://www.ecma-international.org/ecma-402/1.0/) is explained in this [Cordova blog post](https://cordova.apache.org/news/2017/11/20/migrate-from-cordova-globalization-plugin.html).\n\n## Installation\n\n    cordova plugin add cordova-plugin-globalization\n\n## Objects\n\n- GlobalizationError\n\n## Methods\n\n- navigator.globalization.getPreferredLanguage\n- navigator.globalization.getLocaleName\n- navigator.globalization.dateToString\n- navigator.globalization.stringToDate\n- navigator.globalization.getDatePattern\n- navigator.globalization.getDateNames\n- navigator.globalization.isDayLightSavingsTime\n- navigator.globalization.getFirstDayOfWeek\n- navigator.globalization.numberToString\n- navigator.globalization.stringToNumber\n- navigator.globalization.getNumberPattern\n- navigator.globalization.getCurrencyPattern\n\n## navigator.globalization.getPreferredLanguage\n\nGet the BCP 47 language tag for the client's current language.\n\n```js\n    navigator.globalization.getPreferredLanguage(successCallback, errorCallback);\n```\n\n### Description\n\nReturns the BCP-47 compliant language identifier tag to the `successCallback`\nwith a `properties` object as a parameter. That object should have a `value`\nproperty with a `String` value.\n\nIf there is an error getting the language, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.UNKNOWN_ERROR`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Browser\n- Firefox OS\n- iOS\n- Windows Phone 8\n- Windows\n\n### Example\n\nWhen the browser is set to the `en-US` language, this should display a\npopup dialog with the text `language: en-US`:\n\n```js\n    navigator.globalization.getPreferredLanguage(\n        function (language) {alert('language: ' + language.value + '\\n');},\n        function () {alert('Error getting language\\n');}\n    );\n```\n\n### Android Quirks\n\n- Returns the ISO 639-1 two-letter language code, upper case ISO 3166-1\ncountry code and variant separated by hyphens. Examples: \"en\", \"en-US\", \"US\"\n\n### Windows Phone 8 Quirks\n\n- Returns the ISO 639-1 two-letter language code and ISO 3166-1 country code\nof the regional variant corresponding to the \"Language\" setting, separated by\na hyphen.\n- Note that the regional variant is a property of the \"Language\" setting and\nnot determined by the unrelated \"Country/Region\" setting on Windows Phone.\n\n### Windows Quirks\n\n- Returns the ISO 639-1 two-letter language code and ISO 3166-1 country code\nof the regional variant corresponding to the \"Language\" setting, separated by\na hyphen.\n\n### Browser Quirks\n\n- Falls back on getLocaleName\n\n## navigator.globalization.getLocaleName\n\nReturns the BCP 47 compliant tag for the client's current locale setting.\n\n```js\n    navigator.globalization.getLocaleName(successCallback, errorCallback);\n```\n\n### Description\n\nReturns the BCP 47 compliant locale identifier string to the `successCallback`\nwith a `properties` object as a parameter. That object should have a `value`\nproperty with a `String` value. The locale tag will consist of a two-letter lower\ncase language code, two-letter upper case country code, and (unspecified) variant\ncode, separated by a hyphen.\n\nIf there is an error getting the locale, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.UNKNOWN_ERROR`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Windows Phone 8\n- Windows\n- Browser\n\n### Example\n\nWhen the browser is set to the `en-US` locale, this displays a popup\ndialog with the text `locale: en-US`.\n```js\n    navigator.globalization.getLocaleName(\n        function (locale) {alert('locale: ' + locale.value + '\\n');},\n        function () {alert('Error getting locale\\n');}\n    );\n```\n\n### Android Quirks\n\n- Java does not distinguish between a set \"langauge\" and set \"locale,\" so this\nmethod is essentially the same as `navigator.globalization.getPreferredLanguage()`.\n\n### Windows Phone 8 Quirks\n\n- Returns the ISO 639-1 two-letter language code and ISO 3166-1 country code\nof the regional variant corresponding to the \"Regional Format\" setting, separated\nby a hyphen.\n\n### Windows Quirks\n\n- Locale setting can be changed in Control Panel -\u003e Clock, Language and Region\n-\u003e Region -\u003e Formats -\u003e Format,\nand in Settings -\u003e Region -\u003e Regional Format on Windows Phone 8.1.\n\n### Browser Quirks\n\n- IE returns the locale of operating system. Chrome and Firefox return browser language tag.\n\n## navigator.globalization.dateToString\n\nReturns a date formatted as a string according to the client's locale and timezone.\n```js\n    navigator.globalization.dateToString(date, successCallback, errorCallback, options);\n```\n\n### Description\n\nReturns the formatted date `String` via a `value` property accessible\nfrom the object passed as a parameter to the `successCallback`.\n\nThe inbound `date` parameter should be of type `Date`.\n\nIf there is an error formatting the date, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.FORMATTING_ERROR`.\n\nThe `options` parameter is optional, and its default values are:\n```js\n    {formatLength:'short', selector:'date and time'}\n```\n\nThe `options.formatLength` can be `short`, `medium`, `long`, or `full`.\n\nThe `options.selector` can be `date`, `time` or `date and time`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Windows Phone 8\n- Windows\n- Browser\n\n### Example\n\nIf the browser is set to the `en_US` locale, this displays a popup\ndialog with text similar to `date: 9/25/2012 4:21PM` using the default\noptions:\n```js\n    navigator.globalization.dateToString(\n        new Date(),\n        function (date) { alert('date: ' + date.value + '\\n'); },\n        function () { alert('Error getting dateString\\n'); },\n        { formatLength: 'short', selector: 'date and time' }\n    );\n```\n### Android Quirks\n- `formatLength` options are a subset of Unicode\n  [UTS #35](http://unicode.org/reports/tr35/tr35-4.html). The default option\n  `short` depends on a user selected date format within\n  `Settings -\u003e System -\u003e Date \u0026 time -\u003e Choose date format`,\n  which provide a `year` pattern only with 4 digits, not 2 digits.\n  This means that it is not completely aligned with\n  [ICU](http://demo.icu-project.org/icu-bin/locexp?d_=en_US\u0026_=en_US).\n\n### Windows Phone 8 Quirks\n\n- The `formatLength` option supports only `short` and `full` values.\n\n- The pattern for 'date and time' selector is always a full datetime format.\n\n- The returned value may be not completely aligned with ICU depending on a user locale.\n\n### Windows Quirks\n\n- The `formatLength` option supports only `short` and `full` values.\n\n- The pattern for 'date and time' selector is always a full datetime format.\n\n- The returned value may be not completely aligned with ICU depending on a user locale.\n\n### Browser Quirks\n\n- Only 79 locales are supported because moment.js is used in this method.\n\n- The returned value may be not completely aligned with ICU depending on a user locale.\n\n- `time` selector supports `full` and `short` formatLength only.\n\n### Firefox OS Quirks\n\n- `formatLength` is not distinguishing `long` and `full`\n- only one method of displaying date (no `long` or `full` version)\n\n## navigator.globalization.getCurrencyPattern\n\nReturns a pattern string to format and parse currency values according\nto the client's user preferences and ISO 4217 currency code.\n```js\n     navigator.globalization.getCurrencyPattern(currencyCode, successCallback, errorCallback);\n```\n\n### Description\n\nReturns the pattern to the `successCallback` with a `properties` object\nas a parameter. That object should contain the following properties:\n\n- __pattern__: The currency pattern to format and parse currency values.  The patterns follow [Unicode Technical Standard #35](http://unicode.org/reports/tr35/tr35-4.html). _(String)_\n\n- __code__: The ISO 4217 currency code for the pattern. _(String)_\n\n- __fraction__: The number of fractional digits to use when parsing and formatting currency. _(Number)_\n\n- __rounding__: The rounding increment to use when parsing and formatting. _(Number)_\n\n- __decimal__: The decimal symbol to use for parsing and formatting. _(String)_\n\n- __grouping__: The grouping symbol to use for parsing and formatting. _(String)_\n\nThe inbound `currencyCode` parameter should be a `String` of one of\nthe ISO 4217 currency codes, for example 'USD'.\n\nIf there is an error obtaining the pattern, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.FORMATTING_ERROR`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- iOS\n- Windows\n\n### Example\n\nWhen the browser is set to the `en_US` locale and the selected\ncurrency is United States Dollars, this example displays a popup\ndialog with text similar to the results that follow:\n```js\n    navigator.globalization.getCurrencyPattern(\n        'USD',\n        function (pattern) {\n            alert('pattern: '  + pattern.pattern  + '\\n' +\n                  'code: '     + pattern.code     + '\\n' +\n                  'fraction: ' + pattern.fraction + '\\n' +\n                  'rounding: ' + pattern.rounding + '\\n' +\n                  'decimal: '  + pattern.decimal  + '\\n' +\n                  'grouping: ' + pattern.grouping);\n        },\n        function () { alert('Error getting pattern\\n'); }\n    );\n```\n\nExpected result:\n```js\n    pattern: $#,##0.##;($#,##0.##)\n    code: USD\n    fraction: 2\n    rounding: 0\n    decimal: .\n    grouping: ,\n```\n\n### Windows Quirks\n\n- Only 'code' and 'fraction' properties are supported\n\n\n## navigator.globalization.getDateNames\n\nReturns an array of the names of the months or days of the week,\ndepending on the client's user preferences and calendar.\n```js\n    navigator.globalization.getDateNames(successCallback, errorCallback, options);\n```\n\n### Description\n\nReturns the array of names to the `successCallback` with a\n`properties` object as a parameter. That object contains a `value`\nproperty with an `Array` of `String` values. The array features names\nstarting from either the first month in the year or the first day of\nthe week, depending on the option selected.\n\nIf there is an error obtaining the names, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.UNKNOWN_ERROR`.\n\nThe `options` parameter is optional, and its default values are:\n```js\n    {type:'wide', item:'months'}\n```\n\nThe value of `options.type` can be `narrow` or `wide`.\n\nThe value of `options.item` can be `months` or `days`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Windows Phone 8\n- Windows\n- Browser\n\n### Example\n\nWhen the browser is set to the `en_US` locale, this example displays\na series of twelve popup dialogs, one per month, with text similar to\n`month: January`:\n```js\n    navigator.globalization.getDateNames(\n        function (names) {\n            for (var i = 0; i \u003c names.value.length; i++) {\n                alert('month: ' + names.value[i] + '\\n');\n            }\n        },\n        function () { alert('Error getting names\\n'); },\n        { type: 'wide', item: 'months' }\n    );\n```\n\n### Firefox OS Quirks\n\n- `options.type` supports a `genitive` value, important for some languages.\n\n### Windows Phone 8 Quirks\n\n- The array of months contains 13 elements.\n- The returned array may be not completely aligned with ICU depending on a user locale.\n\n### Windows Quirks\n\n- The array of months contains 12 elements.\n- The returned array may be not completely aligned with ICU depending on a user locale.\n\n### Browser Quirks\n\n- Date names are not completely aligned with ICU.\n- The array of months contains 12 elements.\n\n## navigator.globalization.getDatePattern\n\nReturns a pattern string to format and parse dates according to the\nclient's user preferences.\n```js\n    navigator.globalization.getDatePattern(successCallback, errorCallback, options);\n```\n\n### Description\n\nReturns the pattern to the `successCallback`. The object passed in as\na parameter contains the following properties:\n\n- __pattern__: The date and time pattern to format and parse dates. The patterns follow [Unicode Technical Standard #35](http://unicode.org/reports/tr35/tr35-4.html). _(String)_\n\n- __timezone__: The abbreviated name of the time zone on the client. _(String)_\n\n- __iana_timezone__: The IANA name of the time zone on the client. _(String)_\n\n- __utc_offset__: The current difference in seconds between the client's time zone and coordinated universal time. _(Number)_\n\n- __dst_offset__: The current daylight saving time offset in seconds between the client's non-daylight saving's time zone and the client's daylight saving's time zone. _(Number)_\n\nIf there is an error obtaining the pattern, the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.PATTERN_ERROR`.\n\nThe `options` parameter is optional, and defaults to the following values:\n```js\n    {formatLength:'short', selector:'date and time'}\n```\n\nThe `options.formatLength` can be `short`, `medium`, `long`, or\n`full`.  The `options.selector` can be `date`, `time` or `date and\ntime`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- iOS\n- Windows Phone 8\n- Windows\n- Browser\n\n### Example\n\nWhen the browser is set to the `en_US` locale, this example displays\na popup dialog with text such as `pattern: M/d/yyyy h:mm a`:\n```js\n    function checkDatePattern() {\n        navigator.globalization.getDatePattern(\n            function (date) { alert('pattern: ' + date.pattern + '\\n'); },\n            function () { alert('Error getting pattern\\n'); },\n            { formatLength: 'short', selector: 'date and time' }\n        );\n    }\n```\n\n### Windows Phone 8 Quirks\n\n- The `formatLength` supports only `short` and `full` values.\n\n- The `pattern` for `date and time` pattern returns only full datetime format.\n\n- The `timezone` returns the full time zone name.\n\n- The `dst_offset` property is not supported, and always returns zero.\n\n- The pattern may be not completely aligned with ICU depending on a user locale.\n\n### Windows Quirks\n\n- The `formatLength` supports only `short` and `full` values.\n\n- The `pattern` for `date and time` pattern returns only full datetime format.\n\n- The `timezone` returns the full time zone name.\n\n- The `iana_timezone` property is not supported, and always returns empty string.\n\n- The `dst_offset` property is not supported, and always returns zero.\n\n- The pattern may be not completely aligned with ICU depending on a user locale.\n\n### Browser Quirks\n\n- The 'pattern' property is not supported and returns empty string.\n\n- Only Chrome returns 'timezone' property. Its format is \"Part of the world/{City}\".\nOther browsers return empty string.\n\n## navigator.globalization.getFirstDayOfWeek\n\nReturns the first day of the week according to the client's user\npreferences and calendar.\n```js\n    navigator.globalization.getFirstDayOfWeek(successCallback, errorCallback);\n```\n### Description\n\nThe days of the week are numbered starting from 1, where 1 is assumed\nto be Sunday.  Returns the day to the `successCallback` with a\n`properties` object as a parameter. That object should have a `value`\nproperty with a `Number` value.\n\nIf there is an error obtaining the pattern, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.UNKNOWN_ERROR`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Windows Phone 8\n- Windows\n- Browser\n\n### Example\n\nWhen the browser is set to the `en_US` locale, this displays a\npopup dialog with text similar to `day: 1`.\n```js\n    navigator.globalization.getFirstDayOfWeek(\n        function (day) {alert('day: ' + day.value + '\\n');},\n        function () {alert('Error getting day\\n');}\n    );\n```\n###\tWindows Quirks\n\n- On Windows 8.0/8.1 the value depends on user' calendar preferences. On Windows Phone 8.1\nthe value depends on current locale.\n\n### Browser Quirks\n\n- Only 79 locales are supported because moment.js is used in this method.\n\n## navigator.globalization.getNumberPattern\n\nReturns a pattern string to format and parse numbers according to the client's user preferences.\n```js\n    navigator.globalization.getNumberPattern(successCallback, errorCallback, options);\n```\n### Description\n\nReturns the pattern to the `successCallback` with a `properties` object\nas a parameter. That object contains the following properties:\n\n- __pattern__: The number pattern to format and parse numbers.  The patterns follow [Unicode Technical Standard #35](http://unicode.org/reports/tr35/tr35-4.html). _(String)_\n\n- __symbol__: The symbol to use when formatting and parsing, such as a percent or currency symbol. _(String)_\n\n- __fraction__: The number of fractional digits to use when parsing and formatting numbers. _(Number)_\n\n- __rounding__: The rounding increment to use when parsing and formatting. _(Number)_\n\n- __positive__: The symbol to use for positive numbers when parsing and formatting. _(String)_\n\n- __negative__: The symbol to use for negative numbers when parsing and formatting. _(String)_\n\n- __decimal__: The decimal symbol to use for parsing and formatting. _(String)_\n\n- __grouping__: The grouping symbol to use for parsing and formatting. _(String)_\n\nIf there is an error obtaining the pattern, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.PATTERN_ERROR`.\n\nThe `options` parameter is optional, and default values are:\n```js\n    {type:'decimal'}\n```\nThe `options.type` can be `decimal`, `percent`, or `currency`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- iOS\n- Windows Phone 8\n- Windows\n- Browser\n\n### Example\n\nWhen the browser is set to the `en_US` locale, this should display a\npopup dialog with text similar to the results that follow:\n```js\n    navigator.globalization.getNumberPattern(\n        function (pattern) {alert('pattern: '  + pattern.pattern  + '\\n' +\n                                  'symbol: '   + pattern.symbol   + '\\n' +\n                                  'fraction: ' + pattern.fraction + '\\n' +\n                                  'rounding: ' + pattern.rounding + '\\n' +\n                                  'positive: ' + pattern.positive + '\\n' +\n                                  'negative: ' + pattern.negative + '\\n' +\n                                  'decimal: '  + pattern.decimal  + '\\n' +\n                                  'grouping: ' + pattern.grouping);},\n        function () {alert('Error getting pattern\\n');},\n        {type:'decimal'}\n    );\n```\nResults:\n```js\n    pattern: #,##0.###\n    symbol: .\n    fraction: 0\n    rounding: 0\n    positive:\n    negative: -\n    decimal: .\n    grouping: ,\n```\n\n### Windows Phone 8 Quirks\n\n- The `pattern` property is not supported, and returns an empty string.\n\n- The `fraction` property is not supported, and returns zero.\n\n### Windows Quirks\n\n- The `pattern` property is not supported, and returns an empty string.\n\n\n### Browser Quirks\n\n- getNumberPattern is supported in Chrome only; the only defined property is `pattern`.\n\n## navigator.globalization.isDayLightSavingsTime\n\nIndicates whether daylight savings time is in effect for a given date\nusing the client's time zone and calendar.\n\n    navigator.globalization.isDayLightSavingsTime(date, successCallback, errorCallback);\n\n### Description\n\nIndicates whether or not daylight savings time is in effect to the\n`successCallback` with a `properties` object as a parameter. That object\nshould have a `dst` property with a `Boolean` value. A `true` value\nindicates that daylight savings time is in effect for the given date,\nand `false` indicates that it is not.\n\nThe inbound parameter `date` should be of type `Date`.\n\nIf there is an error reading the date, then the `errorCallback`\nexecutes. The error's expected code is `GlobalizationError.UNKNOWN_ERROR`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Windows Phone 8\n- Windows\n- Browser\n\n### Example\n\nDuring the summer, and if the browser is set to a DST-enabled\ntimezone, this should display a popup dialog with text similar to\n`dst: true`:\n```js\n    navigator.globalization.isDayLightSavingsTime(\n        new Date(),\n        function (date) {alert('dst: ' + date.dst + '\\n');},\n        function () {alert('Error getting names\\n');}\n    );\n```\n\n\n## navigator.globalization.numberToString\n\nReturns a number formatted as a string according to the client's user preferences.\n```js\n    navigator.globalization.numberToString(number, successCallback, errorCallback, options);\n```\n\n### Description\n\nReturns the formatted number string to the `successCallback` with a\n`properties` object as a parameter. That object should have a `value`\nproperty with a `String` value.\n\nIf there is an error formatting the number, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.FORMATTING_ERROR`.\n\nThe `options` parameter is optional, and its default values are:\n```js\n    {type:'decimal'}\n```\n\nThe `options.type` can be `decimal`, `percent`, or `currency`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- iOS\n- Windows Phone 8\n- Windows\n- Browser\n\n### Example\n\nWhen the browser is set to the `en_US` locale, this displays a popup\ndialog with text similar to `number: 3.142`:\n```js\n    navigator.globalization.numberToString(\n        3.1415926,\n        function (number) {alert('number: ' + number.value + '\\n');},\n        function () {alert('Error getting number\\n');},\n        {type:'decimal'}\n    );\n```\n\n### Windows Quirks\n\n- Windows 8.0 does not support number rounding, therefore values will not be rounded automatically.\n\n- On Windows 8.1 and Windows Phone 8.1 fractional part is being truncated instead of rounded in case of `percent` number type therefore fractional digits count is set to 0.\n\n- `percent` numbers are not grouped as they can't be parsed in stringToNumber if grouped.\n\n### Browser Quirks\n\n- `currency` type is not supported.\n\n## navigator.globalization.stringToDate\n\nParses a date formatted as a string, according to the client's user\npreferences and calendar using the time zone of the client, and\nreturns the corresponding date object.\n```js\n    navigator.globalization.stringToDate(dateString, successCallback, errorCallback, options);\n```\n\n### Description\n\nReturns the date to the success callback with a `properties` object as\na parameter. That object should have the following properties:\n\n- __year__: The four digit year. _(Number)_\n\n- __month__: The month from (0-11). _(Number)_\n\n- __day__: The day from (1-31). _(Number)_\n\n- __hour__: The hour from (0-23). _(Number)_\n\n- __minute__: The minute from (0-59). _(Number)_\n\n- __second__: The second from (0-59). _(Number)_\n\n- __millisecond__: The milliseconds (from 0-999), not available on all platforms. _(Number)_\n\nThe inbound `dateString` parameter should be of type `String`.\n\nThe `options` parameter is optional, and defaults to the following\nvalues:\n```js\n    {formatLength:'short', selector:'date and time'}\n```\n\nThe `options.formatLength` can be `short`, `medium`, `long`, or\n`full`.  The `options.selector` can be `date`, `time` or `date and\ntime`.\n\nIf there is an error parsing the date string, then the `errorCallback`\nexecutes with a `GlobalizationError` object as a parameter. The\nerror's expected code is `GlobalizationError.PARSING_ERROR`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Windows Phone 8\n- Windows\n- Browser\n\n### Example\n\nWhen the browser is set to the `en_US` locale, this displays a\npopup dialog with text similar to `month:8 day:25 year:2012`. Note\nthat the month integer is one less than the string, as the month\ninteger represents an array index.\n```js\n    navigator.globalization.stringToDate(\n        '9/25/2012',\n        function (date) {alert('month:' + date.month +\n                               ' day:'  + date.day   +\n                               ' year:' + date.year  + '\\n');},\n        function () {alert('Error getting date\\n');},\n        {selector: 'date'}\n    );\n```\n\n### Windows Phone 8 Quirks\n\n- The `formatLength` option supports only `short` and `full` values.\n\n- The pattern for 'date and time' selector is always a full datetime format.\n\n- The inbound `dateString` parameter should be formed in compliance with a pattern returned by getDatePattern.\nThis pattern may be not completely aligned with ICU depending on a user locale.\n\n### Windows Quirks\n\n- The `formatLength` option supports only `short` and `full` values.\n\n- The pattern for 'date and time' selector is always a full datetime format.\n\n- The inbound `dateString` parameter should be formed in compliance with a pattern returned by getDatePattern.\nThis pattern may be not completely aligned with ICU depending on a user locale.\n\n### Browser Quirks\n\n- Only 79 locales are supported because moment.js is used in this method.\n\n- Inbound string should be aligned with `dateToString` output format and may not completely aligned with ICU depending on a user locale.\n\n- `time` selector supports `full` and `short` formatLength only.\n\n## navigator.globalization.stringToNumber\n\nParses a number formatted as a string according to the client's user\npreferences and returns the corresponding number.\n```js\n    navigator.globalization.stringToNumber(string, successCallback, errorCallback, options);\n```\n\n### Description\n\nReturns the number to the `successCallback` with a `properties` object\nas a parameter. That object should have a `value` property with a\n`Number` value.\n\nIf there is an error parsing the number string, then the\n`errorCallback` executes with a `GlobalizationError` object as a\nparameter. The error's expected code is\n`GlobalizationError.PARSING_ERROR`.\n\nThe `options` parameter is optional, and defaults to the following\nvalues:\n```js\n    {type:'decimal'}\n```\n\nThe `options.type` can be `decimal`, `percent`, or `currency`.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- iOS\n- Windows Phone 8\n- Windows\n\n### Example\n\nWhen the browser is set to the `en_US` locale, this should display a\npopup dialog with text similar to `number: 1234.56`:\n```js\n    navigator.globalization.stringToNumber(\n        '1234.56',\n        function (number) {alert('number: ' + number.value + '\\n');},\n        function () {alert('Error getting number\\n');},\n        {type:'decimal'}\n    );\n```\n\n### Windows Phone 8 Quirks\n\n- In case of `percent` type the returned value is not divided by 100.\n\n### Windows Quirks\n\n- The string must strictly conform to the locale format. For example, percent symbol should be\nseparated by space for 'en-US' locale if the type parameter is 'percent'.\n\n- `percent` numbers must not be grouped to be parsed correctly.\n\n## GlobalizationError\n\nAn object representing a error from the Globalization API.\n\n### Properties\n\n- __code__:  One of the following codes representing the error type _(Number)_\n  - `GlobalizationError.UNKNOWN_ERROR`: 0\n  - `GlobalizationError.FORMATTING_ERROR`: 1\n  - `GlobalizationError.PARSING_ERROR`: 2\n  - `GlobalizationError.PATTERN_ERROR`: 3\n- __message__:  A text message that includes the error's explanation and/or details. _(String)_\n\n### Description\n\nThis object is created and populated by Cordova, and returned to a callback in the case of an error.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Windows Phone 8\n- Windows\n\n### Example\n\nWhen the following error callback executes, it displays a\npopup dialog with the text similar to `code: 3` and `message:`\n```js\n    function errorCallback(error) {\n        alert('code: ' + error.code + '\\n' +\n              'message: ' + error.message + '\\n');\n    };\n```\n","funding_links":[],"categories":["Index"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fcordova-plugin-globalization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapache%2Fcordova-plugin-globalization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fcordova-plugin-globalization/lists"}