cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vladimir-kotikov <...@git.apache.org>
Subject [GitHub] cordova-plugin-contacts pull request: CB-8115 Save contact birthda...
Date Wed, 02 Dec 2015 11:16:32 GMT
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message