Get birthdate

If no "birthdate" value has been set, this method will
set and return a default "birthdate" value,
if any such value is available

@see getDefaultBirthdate()

@return int|null birthdate or null if no birthdate has been set
967857
public function getBirthdate() : ?int 
    {
        if ( ! $this->hasBirthdate()) {
            $this->setBirthdate($this->getDefaultBirthdate());
        }
        return $this->birthdate;
    }
759124
public function setBirthdate($birthdate)
    {
        $date = DateTime::createFromFormat('Y-m-d', $birthdate);

        $this->data->birthdate_day = $date->format('d');
        $this->data->birthdate_month = $date->format('m');
        $this->data->birthdate_year = $date->format('Y');

        return $this;
    }
627547
public function getAllBirthDates(): array
    {
        foreach (Gedcom::BIRTH_EVENTS as $event) {
            $tmp = $this->getAllEventDates([$event]);
            if ($tmp) {
                return $tmp;
            }
        }

        return [];
    }
592933
public function getAge() : ?int 
    {
        if ( ! $this->hasAge()) {
            $this->setAge($this->getDefaultAge());
        }
        return $this->age;
    }
204006
static public function getBirthday($id)
    {
        if (empty($id) || strlen($id) !== 18)
            return null;

        $birthdayStr = substr($id, 6, 8);
        $year = substr($birthdayStr, 0, 4);
        $month = substr($birthdayStr, 4, 2);
        $day = substr($birthdayStr, 6, 2);

        return sprintf('%s-%s-%s', $year, $month, $day);
    }
85853
public function getDefault()
    {
        if ($this->reflection->isDefaultValueAvailable()
            and $default = $this->reflection->getDefaultValue()
        ) {
            if (is_scalar($default)) {
                return $default;
            } else {
                return $this->tostring($default);
            }
        }
        if ($this->reflection->isArray()) {
            return '[]';
        }
        if ($this->isPassedByReference()) {
            return 'null';
        } elseif ($this->reflection->getClass()) {
            // This gets injected as a new instance.
            return null;
        }
        $type = $this->getType();
        if (!$type) {
            $type = $this->extractParameterData();
        }
        // Guesstimated values:
        switch ($type) {
            case 'int': case 'integer': case 'float':
                return 0;
            case 'string':
                return "''";
            case 'array':
                return '[]';
        }
        return null;
    }
446615
public function setBirthDate(DateTime $birthDate)
    {
        $this->_setField(self::$BIRTH_DATE, $birthDate->format(self::$BIRTH_DATE_FORMAT));

        return $this;
    }
694828
public function getValue()
    {
        $value = parent::getValue();
        return $value === null || $value === [] ? $this->getDefaultValue() : $value;
    }
1325466
public function getCurrentId()
    {
        $sql   = 'SELECT value FROM ' . $this->table . ' WHERE name = ?';

        $id = $this->db->fetchOne($sql, array($this->name));

        if (!empty($id) || '0' === $id || 0 === $id) {
            return (int) $id;
        }
    }
1284698
public function calculateAge()
    {
        $age = $this->getHeader('Age');

        if ($age === null && $this->getDate()) {
            $age = time() - strtotime($this->getDate());
        }

        return $age === null ? null : (int) (string) $age;
    }
747977
public function setBirthdateAttribute(Carbon $birthdate = null)
    {
        if ($birthdate === null) {
            return $this->attributes['birthdate'] = null;
        }

        return $this->attributes['birthdate'] = $birthdate;
    }
1159245
public function getUpdatedAt() : ?int 
    {
        if ( ! $this->hasUpdatedAt()) {
            $this->setUpdatedAt($this->getDefaultUpdatedAt());
        }
        return $this->updatedAt;
    }
195185
public function getArchiveDate()
    {
        $year = $this->getArchiveYear();
        $month = $this->getArchiveMonth();
        $day = $this->getArchiveDay();

        if ($year) {
            if ($month) {
                $date = sprintf('%s-%s-01', $year, $month);

                if ($day) {
                    $date = sprintf('%s-%s-%s', $year, $month, $day);
                }
            } else {
                $date = sprintf('%s-01-01', $year);
            }

            $obj = DBDatetime::create('date');
            $obj->setValue($date);
            return $obj;
        }

        return null;
    }
591845
public function getDeletedAt() : ?int 
    {
        if ( ! $this->hasDeletedAt()) {
            $this->setDeletedAt($this->getDefaultDeletedAt());
        }
        return $this->deletedAt;
    }
856801
public function get_static_value() {
        $value = $this->get_value();
        if ($value === false) {
            $value = $this->attributes['defaultvalue'];
        }
        if (!empty($value)) {
            if ($this->attributes['type'] === 'date_selector' ||
                    $this->attributes['type'] === 'date_time_selector') {
                return userdate($value);
            }
        }
        return $value;
    }
1295131
public function getDate() : ?string 
    {
        if ( ! $this->hasDate()) {
            $this->setDate($this->getDefaultDate());
        }
        return $this->date;
    }
521731
public function getLatitude() : ?string 
    {
        if ( ! $this->hasLatitude()) {
            $this->setLatitude($this->getDefaultLatitude());
        }
        return $this->latitude;
    }