aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2012-07-16 23:36:11 +0200
committerThomas Tanghus <thomas@tanghus.net>2012-07-16 23:36:11 +0200
commiteb2a15d58f69bc54f818a99bb381c358c7cf4b55 (patch)
tree9ee1e5fc5ef59fcaff4422056868237a9ed43a30
parent47d50fc424cb949903f33a8750625fc419a3520f (diff)
downloadnextcloud-server-eb2a15d58f69bc54f818a99bb381c358c7cf4b55.tar.gz
nextcloud-server-eb2a15d58f69bc54f818a99bb381c358c7cf4b55.zip
Format birthday as BDAY;VALUE=DATE:YYYY-MM-DD. Fixes oc-1276.
-rw-r--r--apps/contacts/ajax/saveproperty.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/contacts/ajax/saveproperty.php b/apps/contacts/ajax/saveproperty.php
index 96e082d00e9..a27b5489ce6 100644
--- a/apps/contacts/ajax/saveproperty.php
+++ b/apps/contacts/ajax/saveproperty.php
@@ -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':