You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Thanasin Khetsit (JIRA)" <ji...@apache.org> on 2015/01/13 16:56:34 UTC

[jira] [Commented] (CB-8115) incorrect birthday saved to phonebook using Contacts Plugin

    [ https://issues.apache.org/jira/browse/CB-8115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14275431#comment-14275431 ] 

Thanasin Khetsit commented on CB-8115:
--------------------------------------

For iOS, you might need to apply timezone offset after create Date object.
There are several ways to check this using web browser console.
1. Run new Date("16 May 1984") in the console. The browser will print date time object with timezone for example: Wed May 16 1984 00:00:00 GMT+0700 (ICT)
2. Run new Date("16 May 1984").getTime() in the console. You will got the javascript date time in millisecond for example: 453488400000
Validate the number you've in GMT timezone for me I convert it to unix date time (divide it by 1000) in this case it will be 453488400 and use this website for validation http://www.onlineconversion.com/unix_time.htm
For my case , the UTC time will be Tue, 15 May 1984 17:00:00 GMT (one day less).

> incorrect birthday saved to phonebook using Contacts Plugin
> -----------------------------------------------------------
>
>                 Key: CB-8115
>                 URL: https://issues.apache.org/jira/browse/CB-8115
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaJS, Plugin Contacts
>    Affects Versions: 4.0.0
>         Environment: Android and IOS
>            Reporter: Kiran Jain
>              Labels: Contacts, Cordova, IOS, android, birthday
>
> We are facing an issue while trying to add birthday to Contact while using Cordova for android while adding a new contact to the phonebook
> following is part of the code
> contact = navigator.contacts.create({
> "displayName": displayname
> });
> // store contact name
> var contactName = new ContactName();
> contactName.familyName = lastname;
> contactName.givenName = firstname
> contact.name = contactName;
> contact.birthday = new Date("16 May 1984");
> // save the contact
> contact.save();
> With above code, when data is viewed in android phone, the birthday is save as 29-12-6731 instead of expected 16-May-1984
> we have tried all possible combinations of date entry viz: 16-May-1984 ; 16/May/1984 ; 16/5/1984 ; new date(1984,05,16)
> but all in vain the results are the same.
> also need to know how to save anniversary date
> when using this plugin for IOS, the date saved is 15-May-1984 (1 day less than expected).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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