- Overview
- Platform Support
- The Command-Line Interface
- Platform Guides
- Using Plugman to Manage Plugins
- The config.xml File
- Icons and Splash Screens
- Embedding WebViews
- Plugin Development Guide
- Privacy Guide
- Whitelist Guide
- Accelerometer
- Camera
- Capture
- Compass
- Connection
- Contacts
- Device
- Events
- File
- Geolocation
- Globalization
- InAppBrowser
- Media
- Notification
- Splashscreen
- Storage
This version of the documentation is outdated!
Click here for the latest released version.
GlobalizationError
An object representing a error from the Globalization API.
Properties
- code: One of the following codes representing the error type (Number)
- GlobalizationError.UNKNOWN_ERROR: 0
- GlobalizationError.FORMATTING_ERROR: 1
- GlobalizationError.PARSING_ERROR: 2
- GlobalizationError.PATTERN_ERROR: 3
- message: A text message that includes the error's explanation and/or details (String)
Description
This object is created and populated by Cordova, and returned to a callback in the case of an error.
Supported Platforms
- Amazon Fire OS
- Android
- BlackBerry WebWorks 5.0+
- iOS
Quick Example
When the following error callback executes, it displays a
popup dialog with the text similar to code: 3
and message:
function errorCallback(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
};
Full Example
<!DOCTYPE HTML>
<html>
<head>
<title>GlobalizationError Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
function successCallback(date) {
alert('month:' + date.month +
' day:' + date.day +
' year:' + date.year + '\n');
}
function errorCallback(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
};
function checkError() {
navigator.globalization.stringToDate(
'notADate',
successCallback,
errorCallback,
{selector:'foobar'}
);
}
</script>
</head>
<body>
<button onclick="checkError()">Click for error</button>
</body>
</html>