aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/datetime.php13
-rw-r--r--mod/profiles.php16
-rw-r--r--version.inc2
3 files changed, 27 insertions, 4 deletions
diff --git a/include/datetime.php b/include/datetime.php
index 00bac8ad1..47c63e51d 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -134,10 +134,17 @@ function dob($dob) {
if(! $f)
$f = 'ymd';
- if ($dob && $dob != '0000-00-00')
- $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),mktime(0,0,0,$month,$day,$year),'dob');
+ if($dob === '0000-00-00')
+ $value = '';
else
- $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),false,'dob');
+ $value = (($year) ? datetime_convert('UTC','UTC',$dob,'Y-m-d') : datetime_convert('UTC','UTC',$dob,'m-d'));
+
+ $o = '<input type="text" name="dob" value="' . $value . '" placeholder="' . t('YYYY-MM-DD or MM-DD') . '" />';
+
+// if ($dob && $dob != '0000-00-00')
+// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),mktime(0,0,0,$month,$day,$year),'dob');
+// else
+// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),false,'dob');
return $o;
}
diff --git a/mod/profiles.php b/mod/profiles.php
index 86de72629..bea006384 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -234,6 +234,22 @@ function profiles_post(&$a) {
}
$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 != '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 = '0000-' . $dob;
+ }
$name = escape_tags(trim($_POST['name']));
diff --git a/version.inc b/version.inc
index 7bd986426..6c86bf1e2 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2014-11-10.855
+2014-11-11.856