diff options
author | zotlabs <mike@macgirvin.com> | 2018-04-02 13:32:10 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-04-02 13:32:10 -0700 |
commit | 9a1f051068b5d301bbe1f08b6b160447fa94a34a (patch) | |
tree | 770c4dd4c241c2ed9a4cbd94fccf00f51e6228ee /include/datetime.php | |
parent | bcffb6cf55ff2d9d88fcb38105695b14ea3586b3 (diff) | |
download | volse-hubzilla-9a1f051068b5d301bbe1f08b6b160447fa94a34a.tar.gz volse-hubzilla-9a1f051068b5d301bbe1f08b6b160447fa94a34a.tar.bz2 volse-hubzilla-9a1f051068b5d301bbe1f08b6b160447fa94a34a.zip |
missing year on profile birthday input, some optimisations to stats
Diffstat (limited to 'include/datetime.php')
-rw-r--r-- | include/datetime.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/datetime.php b/include/datetime.php index 766c90d16..3a07f1ccf 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -125,10 +125,16 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d */ function dob($dob) { + $y = substr($dob,0,4); + if((! ctype_digit($y)) || ($y < 1900)) + $ignore_year = true; + else + $ignore_year = false; + if ($dob === '0000-00-00' || $dob === '') $value = ''; else - $value = (($year) ? datetime_convert('UTC','UTC',$dob,'Y-m-d') : datetime_convert('UTC','UTC',$dob,'m-d')); + $value = (($ignore_year) ? datetime_convert('UTC','UTC',$dob,'m-d') : datetime_convert('UTC','UTC',$dob,'Y-m-d')); $o = replace_macros(get_markup_template("field_input.tpl"), [ '$field' => [ 'dob', t('Birthday'), $value, ((intval($value)) ? t('Age: ') . age($value,App::$user['timezone'],App::$user['timezone']) : ''), '', 'placeholder="' . t('YYYY-MM-DD or MM-DD') .'"' ] |