[
https://issues.apache.org/jira/browse/CB-11052?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15233184#comment-15233184
]
Sarangan Rajamanickam commented on CB-11052:
--------------------------------------------
I have completed my analysis. Let me summarize the points:
# While saving a contact with a birthday, the birthday must be a date object
instantiate with one of the date constructors such as new Date(1976, 8, 8)/new
Date("1987/8/8")/etc.
# Please refer the following links:
##
[https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date]
## [http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15]
##
[http://stackoverflow.com/questions/3257460/new-date-is-working-in-chrome-but-not-firefox]
# As you can see in the links, the year format is not an optional one. It is
mandatory. For example try the following in chrome browser console new
Date("20/Feb") will make this date "20/Feb/2001". Whereas safari browser
console and firefox browser console will just throw the error as "Invalid
Date". In essence, do NOT create a date without year.
# Now, Looking into cordova on android, I get the behavior as in chrome - i.e.
the default year is made 2001.
## HTML Source: [http://pastebin.com/rgecrmUH]
## JS Source: [http://pastebin.com/NHwnRseK]
Does this mean there is some issue that it returns null for you and 2001 for
me? No. It is just an invalid input (without the year) and so the output might
vary based on various versions.
The conclusion is that a JS Date without year is not a valid scenario and not
supported and the recommendation is not to use it.
As there are no remaining work items on this ticket, I am resolving this.
> contacts: returns birthday as null when year is not specified
> -------------------------------------------------------------
>
> Key: CB-11052
> URL: https://issues.apache.org/jira/browse/CB-11052
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin Contacts
> Reporter: Mohit Gupta
> Assignee: Sarangan Rajamanickam
> Labels: Android, triaged
>
> I have created a contact with birth date without adding the year.(20/Feb)
> When I retrieve the contact from the system,the birth date it returns is
> null.
> I have tested it on Android with different dates, still the same behavior.
> NOTE: IF YOU ADD THE YEAR TO THE DATE, IT WORKS PERFECTLY.
> Versions:
> Android: 6.0.1
> Cordova: 6.1.1
> Platform: 5.1.1
> Cordova-Plugin-Contacts: 2.0.1
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]