[birthday/year_opt] Make year optional for displaying date in birthday ahead

This commit is contained in:
Marc Alexander
2013-10-29 13:43:13 +01:00
parent 32a63f3124
commit 36fdb4d33d

View File

@@ -165,13 +165,13 @@ class portal_birthday_list_module
*/ */
protected function format_birthday($user, $birthday, $date_settings) protected function format_birthday($user, $birthday, $date_settings)
{ {
if (!preg_match('/(?:[0-9])+-+(?:[0-9]{2})+-+(?:[0-9]{4})/', $birthday, $match)) if (!preg_match('/(?:[0-9])+-+(?:[0-9]{2})+-+(?:[0-9]{4})?/', $birthday, $match))
{ {
return ''; return '';
} }
$date = explode('-', $birthday); $date = explode('-', $birthday);
$time = mktime(0, 0, 0, $date[1], $date[0], $date[2]); $time = mktime(0, 0, 0, $date[1], $date[0], (isset($date[2])) ? $date[2] : 0);
$lang_dates = array_filter($user->lang['datetime'], 'is_string'); $lang_dates = array_filter($user->lang['datetime'], 'is_string');
return strtr(date($date_settings, $time), $lang_dates); return strtr(date($date_settings, $time), $lang_dates);