Github user vladimir-kotikov commented on a diff in the pull request:

    
https://github.com/apache/cordova-plugin-contacts/pull/95#discussion_r46402705
  
    --- Diff: src/android/ContactAccessorSdk5.java ---
    @@ -451,7 +452,13 @@ else if 
(mimetype.equals(CommonDataKinds.Website.CONTENT_ITEM_TYPE)
                         else if 
(mimetype.equals(CommonDataKinds.Event.CONTENT_ITEM_TYPE)) {
                             if (isRequired("birthday", populate) &&
                                     CommonDataKinds.Event.TYPE_BIRTHDAY == 
c.getInt(colEventType)) {
    -                            contact.put("birthday", 
c.getString(colBirthday));
    +
    +                            try {
    +                                long timestamp = 
Date.valueOf(c.getString(colBirthday)).getTime();
    +                                contact.put("birthday", timestamp);
    +                            } catch (IllegalArgumentException e) {
    +                                Log.d(LOG_TAG, "Failed to get birthday for 
contact: " + e.getMessage());
    +                            }
    --- End diff --
    
    > Also, if there is an IllegalArgumentException, a birthday won't be set at 
all; is this what we define as expected behaviour for this plugin's API?
    
    I don't see any other appropriate options here. If there is an exception, 
this means that the date is probably malformed, and we can't convert it into a 
valid timestamp, which JS side expects to get. 


---
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