Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.1.3
-
Fix Version/s: 3.2
-
Component/s: Core CiviCRM
-
Labels:None
Description
Birthdate is not exported correctly to VCard. I was able to reproduce this on the demo site. For example, go to
http://drupal.demo.civicrm.org/civicrm/contact/view?reset=1&cid=63
The date of birth for this contact is April 16th, 1980. Click on the "download VCard" icon. I opened the resulting vcf file in Address Book (on my mac) and the date now shows as "July 19, 0025".
This is because, in CRM/Contact/Page/View/Vcard.php, line 86, $defaults['birth_date'] is passed directly to $vcard->setBirthday. However, setBirthday (packages/Contact/Vcard/Build.php, line 943) expects a date in the format "yyyy-mm-dd[Thh:ii[:ss[Z|-06:00]]]".
I'm sorry I don't know how to create a patch, but you could reformat the date in in CRM/Contact/Page/View/Vcard.php, line 86:
if ( CRM_Utils_Array::value( 'birth_date', $defaults )) $vcard->setBirthday( preg_replace( '/(\d
{1,2})\/(\d{1,2})\/(\d
{4})/', '$3-$1-$2', $defaults['birth_date'] ) );