Github user omefire commented on a diff in the pull request:

    
https://github.com/apache/cordova-plugin-contacts/pull/125#discussion_r62395046
  
    --- Diff: www/convertUtils.js ---
    @@ -28,10 +28,19 @@ module.exports = {
         */
         toCordovaFormat: function (contact) {
             var value = contact.birthday;
    -        try {
    -          contact.birthday = new Date(parseFloat(value));
    -        } catch (exception){
    -          console.log("Cordova Contact toCordovaFormat error: exception 
creating date.");
    +        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;
    --- End diff --
    
    Instead of setting it to null, should an exception be raised instead ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org

Reply via email to