error JSON.stringify()ing argument: RangeError: Invalid Date
Cordova Plugin: cordova-plugin-contacts
Verison: 2.1.0 "Contacts"
Verison: 2.1.0 "Contacts"
Open convertUtils.js file
File Path: plugins/cordova-plugin-contacts/www/convertUtils.js
Find function "toCordovaFormat" and remove below try-catch code.
try {
contact.birthday = new Date(parseFloat(value));
} catch (exception){
console.log("Cordova Contact toCordovaFormat error: exception creating date.");
}
add below code instead of try-catch
if (value !== null) {
try {
contact.birthday = new Date(parseFloat(value));
//we might get 'Invalid Date' which does not throw an error
//and is an instance of Date.
if (isNaN(contact.birthday.getTime())) {
contact.birthday = null;
}
} catch (exception){
console.log("Cordova Contact toCordovaFormat error: exception creating date.");
}
}
Check below screenshot for better understand.
iOS contact card does not have value for "displayName". "displayName" is used for the android devices. So For iOS device, use "name.formatted" instead of "displayName".
Cheers.... Keep Coding... :)
No comments:
Post a Comment