aboutsummaryrefslogtreecommitdiffstats
path: root/include/datetime.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-04-03 19:57:35 -0700
committerzotlabs <mike@macgirvin.com>2018-04-03 19:57:35 -0700
commit245142cc07bd989adfb03bb7680e3db948e7564f (patch)
tree7aa74358ee307f7e4535232e0f0ffe8e68dc87cf /include/datetime.php
parent3bd3686acf2a2878a6275ff9eb303e6ed136d4c9 (diff)
parent5ac0f371c748367b16fedde27edc9771b08bf4c6 (diff)
downloadvolse-hubzilla-245142cc07bd989adfb03bb7680e3db948e7564f.tar.gz
volse-hubzilla-245142cc07bd989adfb03bb7680e3db948e7564f.tar.bz2
volse-hubzilla-245142cc07bd989adfb03bb7680e3db948e7564f.zip
Merge branch 'master' into oauth2
Diffstat (limited to 'include/datetime.php')
-rw-r--r--include/datetime.php8
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') .'"' ]