summaryrefslogtreecommitdiff
path: root/manager
diff options
context:
space:
mode:
Diffstat (limited to 'manager')
-rw-r--r--manager/application/models/User.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/manager/application/models/User.php b/manager/application/models/User.php
index 55eeadb..7b7a519 100644
--- a/manager/application/models/User.php
+++ b/manager/application/models/User.php
@@ -168,7 +168,16 @@ class Default_Model_User {
*/
public function getAge() {
$now = new Zend_Date();
- return $now->sub($this->getDob())->toValue(Zend_Date::YEAR);
+ $dob = $this->getDob();
+ $age = $now->get(Zend_Date::YEAR) - $dob->get(Zend_Date::YEAR);
+
+ // Did we have a happy birthday already this year?
+ $dob->setYear($now);
+ if ($dob->compare($now) > 0) {
+ $age -= 1;
+ }
+
+ return $age;
}
/**