]> git.mxchange.org Git - friendica.git/blobdiff - include/datetime.php
Birthdays are now transmitted reliably to Diaspora
[friendica.git] / include / datetime.php
index 0faea8c90e5fd9e4b8caa31242021f5fb88e584e..76585f9db360ac8a64381cec9ce3ec3aadfc96c2 100644 (file)
@@ -181,13 +181,13 @@ function dob($dob)
 {
        list($year, $month, $day) = sscanf($dob, '%4d-%2d-%2d');
 
-       if ($dob <= '0001-01-01') {
+       if ($dob < '0000-01-01') {
                $value = '';
        } else {
-               $value = (($year) ? datetime_convert('UTC','UTC',$dob,'Y-m-d') : datetime_convert('UTC','UTC',$dob,'m-d'));
+               $value = (($year > 1000) ? datetime_convert('UTC', 'UTC', $dob, 'Y-m-d') : datetime_convert('UTC', 'UTC', '1000-' . $month . '-'. $day, 'm-d'));
        }
 
-       $age = ((intval($value)) ? age($value, $a->user["timezone"], $a->user["timezone"]) : "");
+       $age = (intval($value) ? age($value, $a->user["timezone"], $a->user["timezone"]) : "");
 
        $o = replace_macros(get_markup_template("field_input.tpl"), [
                '$field' => [
@@ -200,12 +200,6 @@ function dob($dob)
                ]
        ]);
 
-       /// @TODO Old-lost code?
-//     if ($dob && $dob > '0001-01-01')
-//             $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),mktime(0,0,0,$month,$day,$year), 'dob');
-//     else
-//             $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),false,'dob');
-
        return $o;
 }