// add 32 days so that we at least get year 00, and then hack around the fact that
// months and days always start with 1.
- if(substr($s,0,10) <= '0001-01-01') {
+ if(substr($s,0,10) == '0000-00-00') {
$d = new DateTime($s . ' + 32 days', new DateTimeZone('UTC'));
return str_replace('1','0',$d->format($fmt));
}
$f = get_config('system','birthday_input_format');
if(! $f)
$f = 'ymd';
- if($dob <= '0001-01-01')
+ if($dob == '0000-00-00')
$value = '';
else
$value = (($year) ? datetime_convert('UTC','UTC',$dob,'Y-m-d') : datetime_convert('UTC','UTC',$dob,'m-d'));
// This only handles foreign or alien networks where a birthday has been provided.
// In-network birthdays are handled within local_delivery
- $r = q("SELECT * FROM contact WHERE `bd` != '' AND `bd` >= '0001-01-01' AND SUBSTRING(`bd`,1,4) != `bdyear` ");
+ $r = q("SELECT * FROM contact WHERE `bd` != '' AND `bd` != '0000-00-00' AND SUBSTRING(`bd`,1,4) != `bdyear` ");
if (dbm::is_result($r)) {
foreach ($r as $rr) {
return 3;
}
- if($contact['term-date'] != '0000-00-00 00:00:00') {
+ if($contact['term-date'] > NULL_DATE) {
logger("dfrn_deliver: $url back from the dead - removing mark for death");
require_once('include/Contact.php');
unmark_for_death($contact);
if ($searchable === 'true') {
$dob = '1000-00-00';
- if (($profile['dob']) && ($profile['dob'] > '0001-01-01'))
+ if (($profile['dob']) && ($profile['dob'] != '0000-00-00'))
$dob = ((intval($profile['dob'])) ? intval($profile['dob']) : '1000') .'-'. datetime_convert('UTC','UTC',$profile['dob'],'m-d');
$about = $profile['about'];
if($a->profile['gender']) $profile['gender'] = array( t('Gender:'), $a->profile['gender'] );
- if(($a->profile['dob']) && ($a->profile['dob'] > '0001-01-01')) {
+ if(($a->profile['dob']) && ($a->profile['dob'] != '0000-00-00')) {
$year_bd_format = t('j F, Y');
$short_bd_format = t('j F');
return;
}
- $dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0001-01-01'; // FIXME: Needs to be validated?
+ $dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0000-00-00'; // FIXME: Needs to be validated?
$y = substr($dob,0,4);
if((! ctype_digit($y)) || ($y < 1900))
$ignore_year = true;
else
$ignore_year = false;
- if($dob > '0001-01-01') {
- if(strpos($dob,'000') === 0) {
+ if($dob != '0000-00-00') {
+ if(strpos($dob,'0000-') === 0) {
$ignore_year = true;
$dob = substr($dob,5);
}
$dob = datetime_convert('UTC','UTC',(($ignore_year) ? '1900-' . $dob : $dob),(($ignore_year) ? 'm-d' : 'Y-m-d'));
if($ignore_year)
- $dob = '0001-' . $dob;
+ $dob = '0000-' . $dob;
}
$name = notags(trim($_POST['name']));