]> source.dussan.org Git - nextcloud-server.git/commitdiff
Format birthday as BDAY;VALUE=DATE:YYYY-MM-DD. Fixes oc-1276.
authorThomas Tanghus <thomas@tanghus.net>
Mon, 16 Jul 2012 21:36:11 +0000 (23:36 +0200)
committerThomas Tanghus <thomas@tanghus.net>
Mon, 16 Jul 2012 21:36:11 +0000 (23:36 +0200)
apps/contacts/ajax/saveproperty.php

index 96e082d00e911c3a3e9812ebf98ccd22dc26649f..a27b5489ce6dfe509d8f9953e09457bb2ed4b1ed 100644 (file)
@@ -89,7 +89,7 @@ switch($element) {
        case 'BDAY':
                $date = New DateTime($value);
                //$vcard->setDateTime('BDAY', $date, Sabre_VObject_Element_DateTime::DATE);
-               $value = $date->format(DateTime::ATOM);
+               $value = $date->format('Y-m-d');
                break;
        case 'FN':
                if(!$value) {
@@ -112,6 +112,13 @@ if(!$value) {
        /* setting value */
        switch($element) {
                case 'BDAY':
+                       // I don't use setDateTime() because that formats it as YYYYMMDD instead of YYYY-MM-DD
+                       // which is what the RFC recommends.
+                       $vcard->children[$line]->setValue($value);
+                       $vcard->children[$line]->parameters = array();
+                       $vcard->children[$line]->add(new Sabre_VObject_Parameter('VALUE', 'DATE'));
+                       debug('Setting value:'.$name.' '.$vcard->children[$line]);
+                       break;
                case 'FN':
                case 'N':
                case 'ORG':