'about' => $contact['about'],
'network' => Strings::formatNetworkName($contact['network'], $contact['url']),
'tags' => $contact['keywords'],
- 'bd' => $contact['birthday'] <= '0001-01-01' ? '' : $contact['birthday'],
+ 'bd' => $contact['birthday'] <= DBA::NULL_DATE ? '' : $contact['birthday'],
'account_type' => Contact::getAccountType($contact),
'actions' => $actions,
];
} else {
$ignore_year = false;
}
- if (!in_array($dob, ['0000-00-00', '0001-01-01'])) {
+ if (!in_array($dob, ['0000-00-00', DBA::NULL_DATE])) {
if (strpos($dob, '0000-') === 0 || strpos($dob, '0001-') === 0) {
$ignore_year = true;
$dob = substr($dob, 5);
// "bd" always contains the upcoming birthday of a contact.
// "birthday" might contain the birthday including the year of birth.
- if ($profile["birthday"] > '0001-01-01') {
+ if ($profile["birthday"] > DBA::NULL_DATE) {
$bd_timestamp = strtotime($profile["birthday"]);
$month = date("m", $bd_timestamp);
$day = date("d", $bd_timestamp);
$profile["bd"] = ( ++$current_year) . "-" . $month . "-" . $day;
}
} else {
- $profile["bd"] = '0001-01-01';
+ $profile["bd"] = DBA::NULL_DATE;
}
} else {
$profile = $default;
$profile["location"] = "";
$profile["about"] = "";
$profile["gender"] = "";
- $profile["birthday"] = '0001-01-01';
+ $profile["birthday"] = DBA::NULL_DATE;
}
$cache[$url][$uid] = $profile;
'location' => $contact['location'], 'about' => $contact['about']];
// Don't update the birthday field if not set or invalid
- if (empty($contact['birthday']) || ($contact['birthday'] < '0001-01-01')) {
+ if (empty($contact['birthday']) || ($contact['birthday'] <= DBA::NULL_DATE)) {
unset($fields['bd']);
}
$profile['gender'] = [L10n::t('Gender:'), $a->profile['gender']];
}
- if (($a->profile['dob']) && ($a->profile['dob'] > '0001-01-01')) {
+ if (!empty($a->profile['dob']) && $a->profile['dob'] > DBA::NULL_DATE) {
$year_bd_format = L10n::t('j F, Y');
$short_bd_format = L10n::t('j F');
}
if (!empty($a->profile['dob'])
- && $a->profile['dob'] > '0001-01-01'
+ && $a->profile['dob'] > DBA::NULL_DATE
&& $age = Temporal::getAgeByTimezone($a->profile['dob'], $a->profile['timezone'], '')
) {
$profile['age'] = [L10n::t('Age:'), $age];
use Friendica\Content\Text\HTML;
use Friendica\Core\Addon;
use Friendica\Core\Config;
-use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\System;
XML::addElement($doc, $author, "poco:displayName", $profile["name"]);
XML::addElement($doc, $author, "poco:updated", $namdate);
- if (trim($profile["dob"]) > '0001-01-01') {
+ if (trim($profile["dob"]) > DBA::NULL_DATE) {
XML::addElement($doc, $author, "poco:birthday", "0000-".date("m-d", strtotime($profile["dob"])));
}
// "poco:birthday" is the birthday in the format "yyyy-mm-dd"
$value = XML::getFirstNodeValue($xpath, $element . "/poco:birthday/text()", $context);
- if (!in_array($value, ["", "0000-00-00", "0001-01-01"])) {
+ if (!in_array($value, ["", "0000-00-00", DBA::NULL_DATE])) {
$bdyear = date("Y");
- $value = str_replace("0000", $bdyear, $value);
+ $value = str_replace(["0000", "0001"], $bdyear, $value);
if (strtotime($value) < time()) {
$value = str_replace($bdyear, $bdyear + 1, $value);